Moving-picture encoding apparatus and moving-picture decoding apparatus

ABSTRACT

According to one embodiment, an encoding apparatus includes a prediction unit, a classifying unit, a first transformer, a second transformer, an order controller, and an entropy coder. The prediction unit obtains a predictive residual signal to be encoded, by using a mode selected from intra-prediction modes. The first transformer obtains first transformation coefficients by subjecting the signal to an orthogonal transformation by use of a first transformation basis if the selected mode is classified into a mode having a prediction direction. The first transformation basis is preset so that a coefficient density after the orthogonal transformation is higher than a coefficient density.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a Continuation Application of PCT Application No.PCT/JP2010/066547, filed Sep. 24, 2010 and based upon and claiming thebenefit of priority from prior International Application No.PCT/JP2010/050087, filed Jan. 7, 2010, the entire contents of all ofwhich are incorporated herein by reference.

FIELD

Embodiments described herein relate generally to a moving pictureencoding apparatus and a moving-picture decoding apparatus.

BACKGROUND

In recent years, a moving-picture coding method in which encodingefficiency is greatly improved has been recommended as ITU-T REC. H.264and ISO/IEC 14496-10 (hereinafter referred to as “H.264”) jointly withITU-T and ISO/IEC. H.264 does not rely on a prediction processing methodbut performs the processes of an orthogonal transformation and aninverse orthogonal transformation using a discrete cosinetransformation.

For instance, WO 2008/157431 and M. Karczewicz, “Improved intra coding”,ITU-T SG16/Q.6, VCEG Document, VCEG-AF15, April 2007 disclose a methodfor improving encoding efficiency by expanding an orthogonaltransformation and an inverse orthogonal transformation in H.264, byproviding each of the nine types of prediction direction determined asintra-prediction modes with a transformation basis designed to increasecoefficient density after an orthogonal transformation of a generatedpredictive residual, and by performing an orthogonal transformation andan inverse orthogonal transformation.

However, the methods described in WO 2008/157431 and M. Karczewicz,“Improved intra coding”, ITU-T SG16/Q.6, VCEG Document, VCEG-AF15, April2007 mentioned above require an orthogonal transformation processesdiffering according to each intra-predation mode. To realize the methodsby using hardware, eight types of configuration of hardware dedicatedfor orthogonal and an inverse orthogonal transformation are required, inaddition to hardware dedicated to a discrete cosine transformation andan inverse discrete cosine transformation as required in H.264. As aresult, circuit scale increases.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of moving-picture encoding apparatusesaccording to first, second and third embodiments.

FIG. 2A is a diagram showing a pixel block to be encoded or decoded andthe direction of prediction process.

FIG. 2B is a diagram showing a 16×16-pixel block indicating a processingblock unit to be encoded or decoded.

FIG. 3A is a diagram showing prediction modes and prediction directionsfor intra prediction.

FIG. 3B is a diagram showing the arrangement of a reference pixel andpixels to be encoded or decoded.

FIG. 3C is a diagram showing an example of horizontal prediction.

FIG. 3D is a diagram showing an example of vertical prediction.

FIG. 4A is a diagram showing the position of 2D data and scanning orderin a 2D-1D transformation using zigzag scanning in a coefficient ordercontroller.

FIG. 4B is a diagram showing 1D data in a 2D-1D transformation using thezigzag scanning in the coefficient order controller.

FIG. 4C is a diagram in which the zigzag scanning in the coefficientorder controller is shown using two types of index.

FIG. 5 is a block diagram of an orthogonal transformer according to thefirst and second embodiments.

FIG. 6 is a block diagram of inverse orthogonal transformer according tothe first, second, fifth and sixth embodiments.

FIG. 7A is a diagram showing correspondence between intra-predictionmodes and orthogonal transformation numbers.

FIG. 7B is a diagram explaining an orthogonal transformation numbers andnames.

FIG. 8 is a block diagram of a coefficient order controller.

FIG. 9 is a diagram in which scanning orders differing according to eachintra-prediction direction in the coefficient order controller is shownusing two type of index.

FIG. 10A is a flowchart showing the processing of a block to be encodedaccording to the first embodiment.

FIG. 10B is a flowchart continued from the flowchart in FIG. 10A.

FIG. 11 is a syntax structure according to the first to eighthembodiments.

FIG. 12 is a diagram showing information included in slice header syntaxaccording to the first to eighth embodiments.

FIG. 13 is a diagram showing information included in macroblock layersyntax according to the first to eighth embodiments.

FIG. 14 is a block diagram of an intra-prediction image generatoraccording to the second and sixth embodiments.

FIG. 15 is a diagram showing the relation between the bi-directionalintra-prediction, unidirectional prediction mode number, andtransformation number, according to the second and sixth embodiments.

FIG. 16 is a diagram showing information included in slice header syntaxaccording to the second and sixth embodiments.

FIG. 17 is a diagram showing information included in macroblock layersyntax according to the second and sixth embodiments.

FIG. 18 is a block diagram of an orthogonal transformer according to thethird embodiment.

FIG. 19A is a diagram showing the relation between the prediction modenumber and transformation number according to the third and seventhembodiments.

FIG. 19B is a diagram showing the transformation numbers and namesaccording the third and seventh embodiments.

FIG. 20 is a block diagram for an inverse orthogonal transformationaccording to the third and seventh embodiments.

FIG. 21 is a block diagram of a moving-picture decoding apparatusaccording to the fifth to eighth embodiments.

FIG. 22 is a block diagram of a coefficient order controller accordingto the fifth to eighth embodiments.

FIG. 23 is a block diagram of an orthogonal transformer according to thefourth embodiment.

FIG. 24 is a block diagram of an inverse orthogonal transformeraccording to the fourth and eighth embodiments.

FIG. 25A is a diagram showing the relation between the prediction modenumber and the transformation number according to the fourth and eighthembodiments.

FIG. 25B is a diagram showing the transformation numbers and namesaccording the fourth and eighth embodiments.

FIG. 26A is a diagram showing one dimensional transformation numbers andtwo dimensional transformation numbers according to the fourth andeighth embodiments.

FIG. 26B is a diagram showing vertical one dimensional transformationnumbers and the name of matrices according to the fourth and eighthembodiments.

FIG. 26C is a diagram showing horizontal one dimensional transformationnumbers and the name of matrices according to the fourth and eighthembodiments.

DETAILED DESCRIPTION

A moving-picture encoding apparatus and moving-picture decodingapparatus according to embodiments will be described in detail belowwith reference to the accompanying drawings. In the description below,parts labeled with the same reference sign perform the same operations,and duplicate explanations are omitted.

An object of the embodiment is to provide a moving-picture encodingapparatus and a moving-picture decoding apparatus that increasecoefficient density after an orthogonal transformation and that reducecircuit scale in realization of hardware for an orthogonaltransformation and an inverse orthogonal transformation.

In general, according to one embodiment, a moving-picture encodingapparatus includes a prediction unit, a classifying unit, a firstorthogonal transformer, a second orthogonal transformer, an ordercontroller, and an entropy coder. A prediction unit obtains a predictiveresidual signal to be encoded, by using an intra-prediction thatcorresponds to a mode selected from a plurality of intra-predictionmodes. A classifying unit classifies the selected mode into a firstprediction mode indicating an intra-prediction using a predictiondirection or a second prediction mode indicating an intra-predictionusing no prediction direction. A first orthogonal transformer obtains aplurality of first transformation coefficients by subjecting thepredictive residual signal to an orthogonal transformation by use of afirst transformation basis if the selected mode is classified as thefirst prediction mode. The first transformation basis is preset so thata first coefficient density after the orthogonal transformation ishigher than a second coefficient density. A second orthogonaltransformer obtains a plurality of second transformation coefficients bysubjecting the predictive residual signal to the orthogonaltransformation if the selected mode is classified into the secondprediction mode. An order controller rearranges the obtained one of thefirst transformation coefficients and the second transformationcoefficients according to scanning order. An entropy coder encodes therearranged transformation coefficients and information indicating theselected mode.

Now, first to eighth embodiments will be described with reference to thedrawings. The first, second, third, and fourth embodiments are for amoving-picture encoding apparatus and the fifth, sixth, seventh, andeighth embodiments are for a moving-picture decoding apparatus.

The moving-picture encoding apparatus described below divides each framecomposing an input image signal into a plurality of pixel blocks,subjects each of these separate pixel blocks to an encoding process,thereby compression-encoding it, and then outputs a sequence of symbols.

First, the first to fourth embodiments relating to the moving-pictureencoding apparatus will be described.

First Embodiment

Referring to FIG. 1, a moving-picture encoding apparatus 100 realizingan encoding method using this embodiment will be described.

Based on an encoding parameter input from an encoding controller 116,the moving-picture encoding apparatus 100 shown in FIG. 1 performs anintra-prediction (prediction within a picture or frame) orinter-prediction (prediction between pictures or frames) encodingprocess, thereby generating a prediction image signal 127. Subsequently,this encoding apparatus 100 subjects a differential signal between aninput image signal 118 and the prediction image signal 127 to anorthogonal transformation and quantization, subjects the result toentropy encoding, and outputs coded data 130.

The moving-picture encoding apparatus 100 divides the input image signal118 of a moving or still picture into pixel block units, for examplemacroblock units, and inputs them. The input image signal 118 is anencoding process unit that includes both a frame and a field. In thepresent embodiment, a description is given of an example where a frameis used as an encoding process unit.

The moving-picture encoding apparatus 100 performs an encoding that usesa plurality of prediction modes different in block size and in method togenerate the prediction image signal 127. Specifically, the method ofgenerating the prediction image signal 127 is roughly classified intotwo categories: intra-prediction (frame intra-prediction or pictureintra-prediction) for generating a prediction image only within a frameto be encoded; and an inter-prediction (inter-frame prediction orinter-picture prediction) for predicting using a plurality of referenceframes differing in time. A detailed description of the presentembodiment is given using an example where a prediction image signal isgenerated using intra-prediction.

In the first to fourth embodiments, it is assumed for ease ofexplanation that an encoding process is performed from the upper leftside toward the lower right side, as shown in FIG. 2A. In FIG. 2A, in acoded frame f being encoded, blocks located on the left of and above ablock c to be encoded are blocks p already encoded.

In the first to fourth embodiments, it is assumed that a macroblock is abasic processing block size for the encoding process. For example, amacroblock is typically a 16×16-pixel block, shown in FIG. 2B. However,a macroblock may be a 32×32- or 8×8-pixel block. Additionally, the shapeof a macroblock does not have to be a square grid. In the descriptionbelow, a block to be encoded or macroblock of the input image signal 118will simply be called “a prediction target block.”

The moving-picture encoding apparatus 100 includes a subtractor 101, anorthogonal transformer 102, a quantizer 103, an inverse quantizer 104,an inverse orthogonal transformer 105, an adder 106, a reference imagememory 107, an intra-prediction image generator 108, an inter-predictionimage generator 109, a prediction selector 110, a prediction-selectingswitch 111, an intra-prediction classifying unit 112, a coefficientorder controller 113, and an entropy coder 114. The moving-pictureencoding apparatus 100 is connected to an encoding controller 116.

Next, the encoding flow in the moving-picture encoding apparatus 100will be described.

First, the input image signal 118 is input to the subtractor 101.Further, the prediction image signal 127 corresponding to eachprediction mode output from the prediction-selecting switch 111 is inputto the subtractor 101. The subtractor 101 calculates a predictiveresidual signal 119 by subtracting the prediction image signal 127 fromthe input image signal 118. The predictive residual signal 119 is inputto the orthogonal transformer 102.

The orthogonal transformer 102 has the function of subjecting thepredictive residual signal 119 to, for example, a discrete cosinetransformation (DCT). Then, this transformer 102 performs an orthogonaltransformation according to transformation basis selection information129 input from the intra-prediction classifying unit 112 and generatestransformation coefficients 120. The transformation coefficients 120thus generated are input to the quantizer 103. In this description, DCTis used. However, other forms of an orthogonal transformation such as anHadamard transformation, a Karhunen-Loeve transformation (describedbelow), or a discrete sine transformation, may be used. The quantizer103 quantizes the transformation coefficients 120 according to aquantization parameter that indicates fineness of quantization, which isgiven by the encoding controller 116, and also according to quantizationinformation represented by, for example, a quantization matrix thatweights fineness of quantization for each component of thetransformation coefficients. The quantizer 103 outputs quantizedtransformation coefficients 121 to the coefficient order controller 113,and also outputs it to the inverse quantizer 104.

The coefficient order controller 113 has the function of transformingthe two dimensional data of the quantized transformation coefficients121 into one dimensional data based on prediction modes 128 contained inthe prediction information 126 output from the prediction selector 110.An example of a representative scanning order is, for example, zigzagscanning. The quantized transformation coefficients 121 are transformedinto the one dimensional data already changed into a quantizedtransformation coefficients sequence 117, which is input to the entropycoder 114.

The entropy coder 114 subjects the quantized transformation coefficientsequence 117 to entropy encoding such as Huffman encoding or arithmeticencoding. The entropy coder 114 also subjects to entropy encoding theprediction information 126 output from the prediction selector 110, thequantization information output from the encoding controller 116, andvarious encoding parameters used to encode a target block. Thus, codeddata 130 is generated.

The encoding parameters are parameters required to decode predictioninformation, information about transformation coefficients, informationabout quantization, and so on. The encoding parameters for eachprediction target block are held in the internal memory (not shown) ofthe encoding controller 116, and are used when the prediction targetblock is used as a block adjacent to another pixel block.

The coded data 130 generated by the entropy coder 114 is output from themoving-picture encoding apparatus 100, then subjected to multiplexingand so on, temporarily held in an output buffer 115, and subsequentlyoutput as coded data 130 according to an appropriate output timingmanaged by the encoding controller 116. The coded data 130 istransmitted to, for example, a storage system (storage medium) ortransmission system (communication line), not shown.

The inverse quantizer 104 subjects the quantized transformationcoefficients 121 output from the quantizer 103 to inverse quantization.In this case, quantization information used in the quantizer 103 isloaded from the internal memory of the encoding controller 116 andsubjected to an inverse quantization process. Examples of quantizationinformation include the quantization parameter described above, and aparameter represented by the quantization matrix or the like describedabove. The quantized transformation coefficients 121 subjected to theinverse quantization process have been changed into inversely quantizedtransformation coefficients 122 and input to the inverse orthogonaltransformer 105.

The inverse orthogonal transformer 105 subjects the inverse quantizedtransformation coefficients 122 to an inverse orthogonal transformationaccording to transformation base selection information 129 input fromthe intra-prediction classifying unit 112, and thereby reproduces arestored predictive residual signal 123. For example, where DCT has beenperformed in the orthogonal transformer 102, the inverse orthogonaltransformer 105 performs an inverse orthogonal transformation such as aninverse discrete cosine transformation (IDCT). In this description, anexample is given using IDCT. However, where the orthogonal transformer102 uses another form of an orthogonal transformation such as anHadamard transformation, a Karhunen-Loeve transformation (describedbelow), or a discrete sine transformation, an inverse transformation isperformed using their orthogonal transformation bases.

The restored predictive residual signal 123 is input to the adder 106.In this adder 106, the restored predictive residual signal 123 and theprediction image signal 127 output from the prediction-selecting switch111 are added to thereby generate a decoded image signal 124. Thedecoded image signal 124 is a partially decoded image signal. Thedecoded image signal 124 is stored in the reference image memory 107 asa reference image signal 125. The reference image signal 125 stored inthe reference image memory 107 is output to the intra-prediction imagegenerator 108, the inter-prediction image generator 109, etc., and isreferred to for prediction.

The reference image signal 125 stored in the reference image memory 107is output to the intra-prediction image generator 108. Theintra-prediction image generator 108 has the function of performingintra-prediction using the input reference image signal 125. Forexample, in H.264, using a reference pixel value that is locatedadjacent to a prediction target block and that has already been decoded,a pixel is compensated for according to the direction of prediction suchas vertical or horizontal, thereby generating a prediction image. FIG.3A shows the direction of prediction for intra-prediction in H.264.Additionally, FIG. 3B shows the arrangement of reference pixels andpixels to be encoded, in H.264. Further, FIGS. 3C and 3D show examplesof horizontal prediction and orthogonal right downward prediction.Further, FIGS. 7A and 7B show the relation between the prediction modesand corresponding prediction names in H.264. Incidentally, after a pixelvalue is interpolated using a predetermined interpolating method, theinterpolated pixel value may be copied in a predetermined direction ofprediction.

The inter-prediction image generator 109 performs a block matchingprocess based on the prediction target block and the reference imagesignal 125, thereby calculating the amount of difference in motion(motion vector), and performs an interpolation based on this motionvector, thereby generating a prediction image signal. In H.264, aninterpolation image process of up to ¼-pixel precision is possible. Themotion vector thus calculated is entropy-encoded for use as predictioninformation 126.

The prediction-selecting switch 111 has the function of selecting theoutput terminal of the intra-prediction image generator 108 or theoutput terminal of the inter-prediction image generator 109 according tothe prediction information 126. If information indicated by theprediction information 126 is intra-prediction, the switch is connectedto the intra-prediction image generator 108. Conversely, if theprediction information 126 is inter-prediction, the switch is connectedto the inter-prediction image generator 109. An example of theprediction information 126 is described below.

The generated prediction image signal 127 is output to theprediction-selecting switch 111. In addition, the prediction modes 128used for the generation of the prediction image signal 127 arecontrolled by the encoding controller 116. For example, whenintra-prediction is performed in the intra-prediction image generator108, the prediction modes 128 are supplied to the intra-prediction imagegenerator 108 from the encoding controller 116, and the prediction imagesignal 127 is generated according to this value. For example, theencoding controller 116 performs intra-prediction in ascending orderfrom the smallest number of the prediction mode 128 or in descendingorder from the largest one. Alternatively, the prediction modes may belimited according to the characteristics of an input image.Additionally, it is not necessary to generate the prediction imagesignals 127 for all the prediction modes. Instead, the prediction modesmay be limited according to the characteristics of an input image or atleast a prediction image signal 127 may be generated for a block to beencoded.

The prediction selector 110 has the function of setting predictioninformation 126 according to prediction modes controlled by the encodingcontroller 116. Intra-prediction or inter-prediction is selectable asprediction mode, and a plurality of modes may be provided for eachprediction. Specifically, in the prediction mode determination,prediction information 126 (or prediction mode 128) is determined usingthe cost represented by the equation given below. If the number ofsymbols (e.g., the number of symbols representing a motion vector or thenumber of symbols representing a prediction block size) relating to theprediction information 126 required to select this prediction mode 128is represented by OH, and the sum of the absolute difference between theinput image signal 118 and the prediction image signal 127 (whichindicates the absolute cumulative sum of the predictive residual signals119) is represented by SAD, the following determination equation isused.K=SAD+λ×OH  (1)

In the equation, K and λ represent cost and constant respectively. Thesign λ is a Lagrange undetermined multiplier determined based on thevalue of the quantization parameter. In the determination equation, themode in which the cost K results in the smallest value is selected asthe optimum prediction mode.

Instead of the equation (1), the prediction information 126 may bedetermined using: (a) only prediction information; or (b) only SAD.Alternatively, a value obtained by subjecting (b) to an Hadamardtransformation for example, or a value approximate to it, may be used.

Further, as another example, a temporary encoder may be provided, andthe prediction information 126 may be determined using the number ofsymbols when the predictive residual signal 119 generated in a certainprediction mode by the temporary encoder is actually encoded, togetherwith the square of the difference between the input image signal 118 andthe decoded image signal 124. The determination equation in this case isas follows.J=D+λ×R  (2)

In the equation, J represents encoding cost, D represents encodingdeformation indicating the square of the difference between the inputimage signal 118 and the decoded image signal 124. On the other hand, Rrepresents the number of symbols estimated by temporary encoding.

As the use of encoding cost J represented by equation (2) requirestemporary encoding and partial decoding process for each predictionmode, the scale of a circuit or the amount of calculation increases. Onthe other hand, as a more accurate number of symbols and encodingdeformation are used, high encoding efficiency can be maintained.Instead of equation (2), the cost can be calculated using only R or onlyD. Alternatively, a cost function may be formed using a valueapproximate to R or D.

The intra-prediction classifying unit 112 has the function of generatingtransformation basis selection information 129 used in an orthogonaltransformation based on input prediction modes 128.

Above is the outline of the moving-picture encoding apparatus 100according to the present embodiment. Next, the orthogonal transformer102 and the inverse orthogonal transformer 105 are described in detailwith reference to FIGS. 5 and 6. Also, the intra-prediction classifyingunit 112 will be described in detail with reference to FIGS. 7A and 7B.Further, the coefficient order controller 113 will be described indetail with reference to FIG. 8.

The orthogonal transformer 102 in FIG. 5 includes first and secondorthogonal transformers 501 and 502 and a basis-selecting switch 503.FIG. 5 is a block diagram of the orthogonal transformer 102 of themoving-picture encoding apparatus.

First, the basis-selecting switch 503 will be described. Thebasis-selecting switch 503 has the function of selecting the outputterminal of the subtractor 101 according to the transformation basisselection information 129 that has been input. If the transformationbasis selection information 129 is the first orthogonal transformation,the basis-selecting switch 503 connects the switch to the firstorthogonal transformer 501. Conversely, if the transformation basisselection information 129 is the second orthogonal transformation, thebasis-selecting switch 503 connects the output terminal to the secondorthogonal transformer 502. Examples of the transformation basisselection information 129 are shown in FIG. 7B.

Next, processing performed by the first orthogonal transformer 501 willbe described in detail. In intra-prediction used in H.264 for example,since a reference pixel adjacent to a block to be encoded is copied inthe direction of prediction, the predictive residual signal 119 thusgenerated depends on a direction. Since, according to the presentembodiment, a direction of prediction is determined for each predictionmode, transformation efficiency can be improved by designing thetransformation basis in advance so that coefficient density after anorthogonal transformation of predictive residual occurring for everyprediction direction is higher than that before an orthogonaltransformation.

For example, the separable two dimensional orthogonal transformation isexpressed by the following equation.Y=AXB ^(T)  (3)

Each of A and B^(T) represents a transformation matrix, and T representsthe transpose of a matrix. X represents an input matrix before atransformation, and Y represents an output matrix after atransformation. If an image signal is a matrix of N×N, each of A andB^(T) is a transformation matrix of N×N.

Here, in order to perform an orthogonal transformation with accuracyusing integers, a transformation matrix may be changed into the form ofintegers. In this case, an orthogonal transformation is represented bythe following equation.Y=(CXD ^(T))

S  (4)

In the equation, each of C and D^(T) is a transformation matrix in theform of integers and S is a normalized matrix used for scaling. In thiscase, the sign shown below is an equation operator for multiplying theelements of the matrix.

  (5)

For instance, a prediction image signal 127 is generated using as ahorizontal prediction (mode 1) a block to be coded, and a transformationmatrix A is designed using a generated predictive residual signal 119 asan input sample. In this case, the coefficient density when the sameinput sample is subjected to an orthogonal transformation by use of thistransformation matrix is higher than DCT and so on. Using atransformation matrix designed in, for example, a horizontal direction(mode 1), the first orthogonal transformer 501 performs an orthogonaltransformation for an input predictive residual signal 119. Thepredictive residual signal 119 is consequently orthogonally transformedto transformation coefficients 120 by the first orthogonal transformer501, and this coefficient 120 is input to the quantizer 103. A methodusing an orthogonal transformation designed in such a way is called anorthogonal transformation where a direction is taken into account.

Next will be described the second orthogonal transformer 502. The secondorthogonal transformer 502 performs an orthogonal transformation using,for example, DCT. The predictive residual signal 119 is orthogonallytransformed into transformation coefficients 120, and this coefficient120 is input to the quantizer 103. Alternatively, an orthogonaltransformation may be performed using a transformation basis designedusing, for example, vertical prediction (mode 0).

The inverse orthogonal transformer 105 includes a first inverseorthogonal transformer 601, a second inverse orthogonal transformer 602,and a basis-selecting switch 603. First, the basis-selecting switch 603will be described. The basis-selecting switch 603 has the function ofselecting the output terminal of the inverse quantizer 104 according tothe transformation basis selection information 129 that has been input.If the transformation basis selection information 129 is the firstorthogonal transformation, the basis-selecting switch 603 connects itsswitch to the first orthogonal transformer 601. Conversely, if thetransformation basis selection information 129 is the second orthogonaltransformation, the basis-selecting switch 603 connects its outputterminal to the second orthogonal transformer 602.

Next, processing performed by the first inverse orthogonal transformer601 will be described in detail. For example, a separable twodimensional inverse orthogonal transformation is represented by thefollowing equation.X=B ^(T) YA  (6)

Here, in order to perform an inverse orthogonal transformation withaccuracy using integers, a transformation matrix may be changed into theform of integers. In this case, an inverse orthogonal transformation isrepresented by the following equation:X=(D ^(T)(Y

S)C)  (7)

Using the transformation matrix used in the first orthogonal transformer501 and also using equation (6) or (7), the first inverse orthogonaltransformer 601 performs an inverse orthogonal transformation processfor an inversely quantized coefficient 122. For example, the inverseorthogonal transformation process is performed with a transformationmatrix designed using horizontal prediction (mode 1). The inverselyquantized transformation coefficients 122 obtained by the inverseorthogonal transformation is input to the adder 106 in the form of arestored predictive residual signal 123.

Next will be described the second inverse orthogonal transformer 602.Using the transformation matrix used in the second orthogonaltransformer 502 and also using equation (6) or (7), the second inverseorthogonal transformer 602 performs an inverse orthogonal transformationprocess for the inversely quantized coefficient 122. This inverseorthogonal transformation may be, for example, IDCT. Additionally, whereusing a transformation matrix designed using, for example, verticalprediction (mode 0), the second orthogonal transformer 502 performs anorthogonal transformation, and the same transformation matrix is used inthe second inverse orthogonal transformer 602 as well.

Next, the intra-prediction classifying unit 112 will be described. Theintra-prediction classifying unit 112 has the function of generatingtransformation basis selection information 129 used in an orthogonaltransformation, based on input prediction mode 128. Specifically, theintra-prediction classifying unit 112 generates the transformation basisselection information 129 based on the prediction mode 128 contained inprediction information 126 output from the prediction selector 110. Inthis case, using classifying tables shown in FIGS. 7A and 7B, predictionmodes are classified into two groups, and the transformation basisselection information 129 expressed by TransformIdx is set for each ofthe prediction modes classified. FIGS. 7A and 7B show the classifyingmethod employed by the intra-prediction classifying unit 112 of themoving-picture encoding apparatus 100. IntraN×NPredModeIndex shown inthe table indicates a prediction mode 128. N is an index indicating ablock size such that 4 indicates a 4×4-pixel block; 8, an 8×8-pixelblock; and 16, a 16×16-pixel block, and correspondingly for any blocksize other than these. The description has been given using, as anexample, a square block represented by N×N. However, it is easy toextend a block size to a rectangular block represented by M×N.

Where TransformIdx is 0, this indicates use of the first orthogonal andfirst inverse orthogonal transformations. Where TransformIdx is 1, thisindicates the use of the second orthogonal and second inverse orthogonaltransformations. In this case, if a pixel block is a rectangular blockrepresented by M×N, M×N may be used as a block size for an orthogonaltransformation.

In the present embodiment, TransformIdx is set at 1 only for DCprediction (corresponding to prediction mode 2), and TransformIdx is setat 0 for prediction modes that have other spatial prediction directions.

Next will be described the coefficient order controller 113. Thecoefficient order controller 113 has a prediction-mode selecting switch801 and nine types of 2D-1D transformers 802 to 810. The prediction-modeselecting switch 801 connects an output terminal from the quantizer 103to the 2D-1D transformers according to the mode index number of eachprediction mode shown on the left-hand side of FIG. 7A. For instance, ifprediction mode 0 is input, the prediction-mode selecting switch 801connects the output terminal to the vertical 2D-1D transformer 802. Theprediction modes correspond one to one to the 2D-1D transformers suchthat each prediction mode is always connected to the corresponding 2D-1Dtransformer. The prediction modes correspond one to one to the ninetypes of 2D-1D transformers 802 to 810 such that an output terminal isselected for each prediction mode.

The nine types of 2D-1D transformers 802 to 810 have the function oftransforming into one dimensional data the two dimensional data ofquantized transformation coefficients 121 obtained as a result of thequantization process performed by the quantizer 103. For example, inH.264, two dimensional data is transformed into one dimensional data byzigzag scanning.

FIGS. 4A and 4B show an example of transforming two dimensional datawith 4×4 blocks into one dimensional data by use of zigzag scan.Specifically, they show an example where quantized transformationcoefficients 121 contained in a block of 4×4 size are transformed intoone dimensional data by zigzag scanning. If the each component of thequantized transformation coefficients 121 is represented by cij, the2D-1D transformation using zigzag scanning results as shown in FIG. 4C,in which idx represents the index of the one dimensional data after the2D-1D transformation.

The nine types of 2D-1D transformers 802 to 810 use different scanningorders according to each of the prediction modes 128. FIG. 9 shows therelation between prediction modes of a 4×4-pixel block and scanningorders. A different scanning order is selected according to the numberof IntraN×NPredModeIndex shown in FIG. 7A. The description has beengiven using, as an example, a 4×4-pixel block. However, similarly, an8×8-pixel block and 16×16-pixel block can also select scanning ordersthat differ according to each prediction mode. Where a pixel block is arectangular block represented by M×N, M×N may be used as a block sizefor a 2D-1D transformation. In this case, a table of scanning orders forthe corresponding prediction modes, as shown in FIG. 9, may be used forthe rectangular block. The foregoing description is an outline of thepicture-image encoding apparatus 100 according to the presentembodiment.

FIGS. 10A and 10B are flowcharts showing processing of a block(macroblock) to be encoded by the moving-picture encoding apparatus 100.In processes shown in FIGS. 10A and 10B, processes with the same indexindicate the same process content.

When the input image of a block to be encoded is supplied, an encodingprocess for a pixel block is initiated (S1001). First, using a referenceimage signal 125 held in the reference image memory 107, predictionimage signals 127 are generated by the intra-prediction image generator108 and inter-prediction image generator 109 (S1002). According to whichprediction-image generator has formed a prediction image, the encodingcontroller 116 generates the prediction information 126 (including theprediction mode 128) and sets this information in the predictionselector 110. The prediction selector 110 outputs the predictioninformation 126 to the entropy coder 114 as well as to theprediction-selecting switch 111 (S1003). The prediction-selecting switch111 determines whether the prediction information 126 is forintra-prediction or not (S1004). If this information is forintra-prediction (YES), the switch 111 connects its output terminal tothe intra-prediction image generator 108. If this information is forinter-prediction (NO), the switch 111 connects its output terminal tothe inter-prediction image generator 109.

First, a description is given of the case where the predictioninformation 126 is for intra-prediction. The prediction image signal 127generated by the intra-prediction image generator 108 is subtracted fromthe input image signal by the subtractor 101 and generates thepredictive residual signal 119 (S1005). Simultaneously, the predictionselector 110 outputs the prediction information 126, set by the encodingcontroller 116, to the entropy coder 114, and also outputs theprediction mode 128, included in the prediction information 126, to theintra-prediction classifying unit 112 (S1006). In the intra-predictionclassifying unit 112, transformation basis selection information 129 isgenerated from the prediction classification table (FIG. 7A) based onthe input prediction mode 128 (S1007). The generated transformationbasis selection information 129 is input to the orthogonal transformer102, and, based on this information, the basis-selecting switch 503determines where to connect its output terminal (S1008). If thisinformation is YES (TransformIdx is 1), the basis-selecting switch 503connects its output terminal to the second orthogonal transformer 502(S1009). If this information is NO (TransformIdx is 0), thebasis-selecting switch 503 connects its output terminal to the firstorthogonal transformer 501 (S1010).

The predictive residual signal 119 is input to the orthogonaltransformer 102, transmitted to the connected output terminal, andsubjected to the orthogonal transformation process by the firstorthogonal transformer 501 or second orthogonal transformer 502, therebygenerating the transformation coefficients 120 (S1011). Thetransformation coefficients 120 after orthogonal transformation areinput to the quantizer 103. The quantizer 103 performs the quantizationprocess, thereby generating quantized transformation coefficients 121(S1012). The quantized transformation coefficients 121 are input to thecoefficient order controller 113. Based on the input prediction mode128, the coefficient order controller 113 connects the output terminalof the prediction-mode selecting switch 801 to one of the 2D-1Dtransformers 802 to 810 according to the table in FIG. 7A (S1013).

Using the table shown in FIG. 9, the 2D-1D transformers 802 to 810perform the 2D-1D transformation process for the correspondingprediction modes, thereby generating a quantized transformationcoefficient sequence 117 (S1014). The quantized transformationcoefficient sequence 117 is input to the entropy coder 114, subjected toentropy encoding, and then output from the moving-picture encodingapparatus 100 with appropriate timing managed by the encoding controller116 (S1015). On the other hand, the quantized transformationcoefficients 121 are input to the inverse quantizer 104, and subjectedto the inverse quantization process, thereby generating the inverselyquantized transformation coefficients 122 (S1016).

Based on the transformation basis selection information 129, the inverseorthogonal transformer 105 determines where to connect the outputterminal of the basis-selecting switch 603 (S1017). If this informationis YES (TransformIdx is 1), the basis-selecting switch 603 connects itsoutput terminal to the second inverse orthogonal transformer 602(S1018). If this information is NO (TransformIdx is 0), thebasis-selecting switch 603 connects its output terminal to the firstinverse orthogonal transformer 601 (S1019). The inversely transformedtransformation coefficients 122 are input to the inverse orthogonaltransformer 105, transmitted through the connected output terminal, andsubjected to the inverse orthogonal transformation process by the firstinverse orthogonal transformer 601 or second inverse orthogonaltransformer 602, thereby generating a restored predictive residualsignal 123 (S1020). The restored predictive residual signal 123 is addedby the adder 106 to the prediction image signal 127, generated by theintra-prediction image generator 108, then input to the reference imagememory 107 in the form of the decoded image signal 124, and stored(S1021). Thus, one pixel block to be encoded is intra-coded by theforegoing processing (S1022).

Next will be described the case where the prediction information 126 isfor inter-prediction. The prediction image signal 127 generated by theinter-prediction image generator 109 is subtracted from the input imageby the subtractor 101, thereby generating the predictive residual signal119 (S1005). The predictive residual signal 119 is input to theorthogonal transformer 102. In this case, if the predicting method usesinter-prediction, the basis-selecting switch 503 of the orthogonaltransformer 102 always connects its output terminal to the secondorthogonal transformer 502. The input predictive residual signal 119 issubjected to an orthogonal transformation (e.g., DCT) by the secondorthogonal transformer 502, thereby generating the transformationcoefficients 120 (S1011).

The transformation coefficients 120 after an orthogonal transformationare input to the quantizer 103. The quantizer 103 performs thequantizing process, thereby generating the quantized transformationcoefficients 121 (S1012). The quantized transformation coefficients 121are input to the coefficient order controller 113. In the coefficientorder controller 113, if the predicting method involvesinter-prediction, the output terminal of the prediction-mode selectingswitch 801 is always connected to the 2D-1D transformer 804 for DCT.Using zigzag scanning shown in FIG. 4C or the scanning ordercorresponding to Intra_N×N_DC shown in FIG. 9, the 2D-1D transformer 804performs a 2D-1D transformation process, thereby generating a quantizedtransformation coefficient sequence 117 (S1014). The quantizedtransformation coefficient sequence 117 is input to the entropy coder114, subjected to entropy encoding, and then output from themoving-picture encoding apparatus 100 with appropriate timing managed bythe encoding controller 116 (S1015).

On the other hand, the quantized transformation coefficients 121 areinput to the inverse quantizer 104 and subjected to the inversequantization process, thereby generating the inversely quantizedtransformation coefficients 122 (S1016). The inversely quantizedtransformation coefficients 122 are input to the inverse orthogonaltransformer 105. In this case, if the predicting method involvesinter-prediction, the basis-selecting switch 603 of the inverseorthogonal transformer 105 connects its output terminal to the secondinverse orthogonal transformer 602. The inversely transformedtransformation coefficients 122 are input to the inverse orthogonaltransformer 105, transmitted through the connected output terminal, andsubjected to the inverse orthogonal transformation process (e.g., IDCT)by the second inverse orthogonal transformer 602, thereby generating therestored predictive residual signal 123 (S1020). The restored predictiveresidual signal 123 is added by the adder 106 to the prediction imagesignal 127 generated by the inter-prediction image generator 109, theninput to the reference image memory 107 in the form of a decoded imagesignal 124, and stored (S1021). Thus, one pixel block to be coded isinter-coded by the foregoing processing (S1022).

The forgoing is a description of the flowchart for processing performedby the moving-picture encoding apparatus 100 according to the presentembodiment.

Generally, the orthogonal transformation matrices expressed by theequations (3) and (4) are fixed matrices. Therefore, where theorthogonal transformation matrices are mounted in the form of hardware,they are usually configured by use of hard-wired logic without using amultiplier. For example, it is possible to prepare for an orthogonaltransformation in which the direction of prediction is taken intoaccount for each of the nine types of prediction mode defined in H.264.However, since these nine types of prediction mode differ from oneanother in terms of a set of fixed coefficients, eight types ofdedicated hardware have to be configured in addition to the hardwarededicated for DCT required in H.264. As a result, circuit scaleincreases.

Additionally, since the signal used in the moving-picture codingapparatus is two dimensional image data, this signal is subjected to atwo-dimensional orthogonal transformation, as indicated by the equations(3) and (4). In this embodiment, correlation between the vertical andhorizontal directions is removed; therefore, where two types ofseparable orthogonal transformation basis are prepared, sixteen types ofone dimensional orthogonal transformation matrix are additionallyrequired, resulting in increased circuit scale in hardware mounting.

In contrast, the present embodiment can be configured to have only twotypes of orthogonal transformer: one for the first orthogonaltransformation in which an intra-prediction direction is taken intoaccount, and the other for the second orthogonal transformation such asDCT. Accordingly, increase in circuit scale can be prevented.

In the case of an orthogonal transformation in which a predictiondirection is taken into account, the quantized transformationcoefficients 121, obtained by quantizing the transformation coefficients120 that have been subjected to an orthogonal transformation, tends togenerate non-zero transformation coefficients in a block unevenly. Thistendency to generate non-zero transformation coefficients differsaccording to each intra-prediction direction. However, when differentimages are encoded, the tendencies to generate non-zero transformationcoefficients in the same prediction direction have similar properties.In the 2D-1D transformation, entropy encoding is preferentiallyperformed starting with transformation coefficients located where theprobability of the generation of a non-zero transformation coefficientis highest. Thus, information required for encoding transformationcoefficients can be reduced. Therefore, according to the prediction mode128 indicating a prediction direction, the probability of the generationof a non-zero transformation coefficient is learned in advance, and ninetypes of 2D-1D transformation method are determined, thereby decreasingthe number of symbols of a transformation coefficient without increasingthe amount of calculation in comparison with, for example, H.264.

In addition, as in the present embodiment, where the orthogonaltransformer is divided into the two types, i.e., the first orthogonaltransformation in which an intra-prediction direction is taken intoaccount and the second orthogonal transformation such as DCT, aprediction direction other than that for the DC prediction is forciblyassigned to the first orthogonal transformation. Therefore, the degreeof electrical power concentration is not always high unlike where thezigzag scanning order in H.264 is used. For this reason, the property inwhich, in each prediction mode, the tendencies to generate non-zerotransformation coefficients are similar is utilized such that in the2D-1D transformation, entropy encoding is preferentially performedstarting with a transformation coefficient located where the probabilityof generation of a non-zero transformation coefficient is highest, thusenabling a decrease in information required for encoding transformationcoefficients.

Next will be described a method for designing orthogonal transformationmatrices represented by equations (3) and (4). In H.264, nine types ofprediction mode are defined for each of a 4×4-pixel block and an8×8-pixel block and four types of prediction mode are defined for a16×16-pixel block. A direction transformation matrix is designed suchthat prediction directions are taken into account for prediction modesother than DC prediction. A plurality of training images are prepared,and a predictive residual signal 119 assumed to be predicted in acorresponding prediction mode is generated. K training vectors areobtained by accumulation for each prediction mode and generated. Forexample, a training vector for a 4×4-pixel block has K training vectorsof 4×4 size. This training vector is subjected to singular valuedecomposition, thereby generating an orthonormal basis indicating linesand columns.M=UΣV ^(T)  (8)

Here, M represents a training vector of N×N size, U represents a unitarymatrix that has N lines and N columns, and Σ represents a singular-valuematrix in which elements other than the diagonal elements are 0 in Nlines and N columns and the diagonal elements are not negative. V^(T)represents an adjoint matrix (a complex conjugate and transposed matrix)of the unitary matrix that has N lines and N columns. In this case, thepseudo inverse matrix is defined by the following equation.M′=UΣ′V ^(T)  (9)

M′ represents an output vector after an pseudo inverse transformation,E′ represents the transposition of a matrix that has as its elements theinverses of the diagonal elements. Using a linear least-square method, amatrix U and a matrix V are designed for K training vectors so thatsquare error before and after the orthogonal transformation, indicatedby the equations (8) and (9), is smallest. The matrices U and V^(T) thusdesigned are used as a transformation matrix in the equation (3). Eachof the elements of the designed matrices U and V^(T) yields a realnumber. Therefore, when changed into integers, the elements can be usedas a transformation matrix in the equation (4). Here, the descriptionhas been given using a design example for a 4×4-pixel block. However,transformation matrices for an 8×8- or 16×16-pixel block can also bedesigned in a similar manner.

Next will be described a method for designing coefficient scanning orderas shown in FIG. 9. The coefficient scanning order is designed based onthe quantized transformation coefficients 121 generated by the quantizer103. For instance, in the design of the coefficient scanning order for a4×4-pixel block, a plurality of training images are prepared, and thepredictive residual signals 119 after prediction in the nine types ofprediction mode are generated. The predictive residual signals 119 aresubjected to an orthogonal transformation expressed by the equation (3)or (4), and the transformation coefficients 120 are quantized. Thenon-zero transformation coefficients of each of the components of the4×4-pixel block are accumulated and added for the quantizedtransformation coefficients 121. This is performed for all the trainingimages, and a histogram of non-zero transformation coefficients isformed for each of the components of the 4×4-pixel block. Based on thehistograms, indexes 0 to 15 are assigned to them in ascending orderstarting with the highest generation frequency. The indexes thusassigned correspond to scanning order in 1D. Coefficient scanning ordercan be designed by deriving the foregoing indexes for each predictionmode. Here, the description has been given using a design example for a4×4 pixel block. However, coefficient scanning orders can also bedesigned for an 8×8- or 16×16-pixel block in a similar manner.

Next, a syntax structure in the moving-picture encoding apparatus 100will be described. FIG. 11 shows the configuration of syntax 1100. Thesyntax shows the structure of coded data when moving-picture data isencoded. To decode this coded data, syntax is interpreted using adecoding apparatus that has the same syntax configuration. As shown inFIG. 11, the syntax 1100 mainly has three parts. A high level syntax1101 has syntax information corresponding to a layer higher than a slicethat indicates a rectangular area or continuous area contained in aframe or a field. A slice level syntax 1102 has, for each slice,information required for decoding. A macroblock level syntax 1103 has,for each macroblock, information required for decoding.

Each part includes more detailed syntax. The high level syntax 1101includes syntax of sequence and picture levels, such as a sequenceparameter set syntax 1104 and a picture parameter set syntax 1105. Theslice level syntax 1102 includes a slice header syntax 1106, a slicedata syntax 1107, etc. The macroblock level syntax 1103 includes amacroblock layer syntax 1108, a macroblock prediction syntax 1109, etc.

FIG. 12 shows an example of slice header syntax 1106 according to thepresent embodiment. slice_uni_directional_transform_flag shown in FIG.12 is a syntax element indicating whether an orthogonal transformationwhere a direction is taken into account should be used for the slice. Ifslice_uni_directional_transform_flag is 0, the orthogonal transformer102 and inverse orthogonal transformer 105 cannot use the firstorthogonal transformer 501 and first inverse orthogonal transformer 601respectively. In this case, the basis-selecting switch 503 connects itsoutput terminal to the second orthogonal transformer 502 regardless ofthe transformation basis selection information 129, and also thebasis-selecting switch 603 connects its output terminal to the secondinverse orthogonal transformer 602 regardless of the transformationbasis selection information 129. In this case also, the coefficientorder controller 113 can use only the 2D-1D transformer 804 for DCT. Inthis case, the prediction-mode selecting switch 801 connects its outputterminal to the 2D-1D transformer 804 for DCT regardless of theprediction mode 128.

Conversely, if slice_uni_directional_transform_flag is 1, the encodingprocess is performed following the encoding flowcharts illustrated inFIGS. 10A and 10B. Specifically, the orthogonal transformer 102 selectsthe first or second orthogonal transformer 501 or 502 according totransformation basis selection information 129, and also the inverseorthogonal transformer 105 selects the first or second inverseorthogonal transformer 601 or 602 according to the transformation basisselection information 129. The prediction mode selecting switch 801 canconnect its output terminal to the 2D-1D transformers 802 to 810according to the prediction mode 128.

FIG. 13 shows an example of macroblock layer syntax 2108 according toanother embodiment. mb_uni_directional_transform_flag shown in FIG. 13is a syntax element indicating whether an orthogonal transformationwhere a direction is taken into account should be used for themacroblock. mb_type in FIG. 13 indicates the encoding type of the codedmicro block. I_N×N indicates that the encoding type is intra-perditionencoding and that the prediction block size is N×N. N includes 32, 64,etc., as well as 4, 8, and 16. mb_uni_directional_transform_flag iscoded only when slice_uni_directional_transform_flag is 1 and theencoding type of the macroblock is intra-prediction. Ifmb_uni_directional_transform_flag is 0, the orthogonal transformer 102and inverse orthogonal transformer 105 cannot use the first orthogonaltransformer 501 and first inverse orthogonal transformer 601respectively. In this case, the basis-selecting switch 503 connects itsoutput terminal to the second orthogonal transformer 502 regardless ofthe transformation basis selection information 129, and also thebasis-selecting switch 603 connects its output terminal to the secondinverse orthogonal transformer 602 regardless of the transformationbasis selection information 129. In this case also, the control ordercontroller 113 can use only the 2D-1D transformer 804 for DCT. In thiscase, the prediction-mode selecting switch 801 connects its outputterminal to the 2D-1D transformer 804 for DCT regardless of predictionmode 128.

On the other hand, if mb_uni_directional_transform_flag is 1, theencoding process is performed following the encoding flowchartsillustrated in FIGS. 10A and 10B. Specifically, the orthogonaltransformer 102 selects the first or second orthogonal transformer 501or 502 according to the transformation basis selection information 129,and also the inverse orthogonal transformer 105 selects the first orsecond inverse orthogonal transformer 601 or 602 according to thetransformation basis selection information 129. The prediction modeselecting switch 801 can connects its output terminal to the 2D-1Dtransformers 802 to 810 according to the prediction mode 128.

Encoding the flag, which indicates whether the orthogonal transformationwhere a direction is taken into account should be used in a macroblocklayer, increases the amount of information relating to transformationselection, but enables the optimum orthogonal transformation for eachlocal area of an image.

A syntax element that is not defined in the present embodiment may beinserted between the lines in the table of syntax shown in each of FIGS.12 and 13, and description relating to any other conditional branch maybe included between them. Additionally, the syntax table may be dividedinto a plurality of sub-tables or a plurality of syntax tables may beintegrated. The same terms do not have to be used but may arbitrarily bechanged according to the embodiment employed.

According to the foregoing first embodiment, classifying predictiondirections of an intra-prediction mode according to correlations betweenpredictive residuals, and performing an orthogonal transformation or aninverse orthogonal transformation improves coefficient density after antransformation compared to that before an transformation and enables areduction in hardware mounting circuit scale.

Second Embodiment

Next, a second embodiment will be described. The configuration of amoving-picture encoding apparatus according to the second embodiment isidentical to that in the first embodiment except for the internalstructure of an intra-prediction image generator 108. Blocks and syntaxwith the same functions as in the first embodiment are labeled with thesame signs and explanations thereof are omitted. Here, theintra-prediction generator 108 is explained with reference to FIG. 14.FIG. 14 is a block diagram of the intra-prediction generator 108. Theintra-prediction image generator 108 according to the present embodimentincludes a unidirectional intra-prediction image generator 1401, abi-directional intra-prediction image generator 1402, a prediction-modegenerator 1403, and a prediction-selecting switch 1404.

The intra-prediction image generator 108 in the first embodiment hasneither bi-directional intra-prediction image generator 1402 norprediction-selecting switch 1404 shown in FIG. 14. As a description ofthe processing content of the unidirectional intra-prediction imagegenerator 1401 has been given in the first embodiment with reference toFIGS. 3A to 4C, this description is omitted here.

The bi-directional intra-prediction image generator 1402 generates twounidirectional intra-prediction image signals and subjects them toweighted averaging, thereby generating an image signal 127.Bi-directional prediction using horizontal prediction and orthogonalright downward prediction shown in FIGS. 3C and 3D, for example, willnow be described. First, each unidirectional prediction image signal isgenerated. Here, if horizontal prediction and orthogonal right downwardprediction are P1[x, y] and P2[x, y] respectively, a prediction imagesignal P[x, y] for bi-directional prediction is expressed by thefollowing equation:P[x,y]=(W[x,y]*P1[x,y]+(128−W[x,y])*P2[x,y]+64)>>7  (10)

Here, W[x, y] represents a weighted table, and is a matrix with valuesin the range 0 to 128. FIG. 15 shows the prediction numbers ofbi-directional intra-prediction, a combination of two unidirections, andtransformation basis information.

In FIG. 15, IntraN×NPredModeIndexL0 indicates the mode number of firstunidirectional intra-prediction in bi-directional intra-prediction, andIntraN×NPredModeIndexL1 indicates the mode number of secondunidirectional intra-prediction in bi-directional intra-prediction. Theyare marked L0 and L1, which are prediction modes corresponding to thosein FIG. 3A. IntraN×NBiPredModeIndex indicates the mode number ofbi-directional intra-prediction. bipred_intra_flag, which will bedescribed below, is a syntax element indicating whether bi-directionalintra-prediction should be used.

Next, the function of the prediction mode generator 1403 will bedescribed. Where a prediction image signal by bi-directionalintra-prediction is generated by the bi-directional intra-predictionimage generator 1402 based on information input from the encodingcontroller 116, the prediction-mode generator 1403 derives a predictionmode 128 according to the table shown in FIG. 15, and outputs the mode.Specifically, the prediction mode 128 includes bipred_intra_flag,IntraN×NBiPredModeIndex, IntraN×NPredModeIndexL0, andIntraN×NPredModeIndexL1.

The prediction-selecting switch 1404 connects its output terminal toeither one of the intra-prediction image generators 1401 and 1402according to the input prediction mode 128. Here, if bipred_intra_flagis 0, the switch connects its output terminal to the unidirectionalintra-prediction image generator 1401. If bipred_intra_flag is 1, theswitch connects its output terminal to the bi-directionalintra-prediction image generator 1402.

Use of bi-directional prediction expressed by the equation (10) makes itpossible to add a linear change in the direction of prediction, comparedto simple unidirectional prediction. Generation of a prediction imagesignal corresponding to a luminance change such as gradation in anatural image enables prediction closer to an input image.

Here, a description has been given of an example where the table isformed so that IntraN×NPredModeIndexL0 is certain to be smaller thanIntraN×NPredModeIndexL1. Generally, for numbers assigned toIntraN×NPredModeIndex, a smaller number is assigned to a prediction modewith a higher probability of selection. Therefore, designingTransformIdx according to the prediction mode indicated in theIntraN×NPredModeIndexL0 can improve transfer efficiency.IntraN×NPredModeIndexL0 and IntraN×NPredModeIndexL1 may be exchanged. Inthis case also, TransformIdx is set according to a smaller number.

The table in FIG. 15 shows an example where eighteen types ofcombination of bi-directional predictions are added to nine types ofunidirectional prediction mode. However, the number of combinations maybe increased or decreased, and TransformIdx may be set using the samerule.

The foregoing is a description of the intra-prediction image generator108 according to the present embodiment.

Next, an intra-prediction classifying unit 112 will be described. Theintra-prediction classifying unit 112 has the function of generating,based on the input prediction mode 128, the transformation basisselection information 129, which is used for an orthogonaltransformation. That is, the intra-prediction classifying unit 112generates the transformation basis selection information 129 based onthe input prediction mode 128. Here, using the classification tablesshown in FIGS. 7A and 15, the prediction modes are classified into two,and the transformation basis selection information 129 expressed byTransformIdx is set for each of the prediction modes classified. In FIG.15, in the case where, if the intra-prediction mode expressed byIntraN×NPredModeIndexL0 of the two intra-prediction modes is 2 (DCprediction), TransformIdx is set at 1 and TransformIdx corresponding toany direction prediction other than this is set at 0. For example, inthe case where the intra-prediction mode expressed byIntraN×NPredModeIndexL1 is 2, TransformIdx may be set at 1, or cases maybe classified according to the directions in which prediction imagesignals are generated based on predictions of corresponding directions.To be more specific, if IntraN×NPredModeIndexL is 0 andIntraN×NPredModeIndexL1 is 1, for example, the angle formed between thetwo prediction directions is 90 degrees. If, as in such a case, theangle formed by prediction directions is too large, a combination inwhich TransformIdx is 1 can also be prepared.

Next, a coefficient order controller 113 will be described. TransformIdxis determined by the mode number expressed in IntraN×NPredModeIndexL0 inthe input prediction modes 128. IntraN×NPredModeIndexL0 indicates aunidirectional intra-prediction mode and is given nine types ofprediction mode.

Here, nine types of 2D-1D transformers 802 to 810 use scanning ordersdiffering according to prediction mode 128. FIG. 9 shows the relationbetween prediction mode and scanning order in a 4×4-pixel block.According to the number for IntraN×NPredModeINdexL0 in FIG. 15, adifferent scanning order is selected. Here, a description has been givenof an example for a 4×4-pixel block. However, similarly, an 8×8- or16×16-pixel block can select different scanning orders according toprediction mode. In the case where a pixel block is a rectangular blockexpressed by M×N, M×N may be used as a block size for a 2D-1Dtransformation. In this case, a scanning order table as shown in FIG. 9may be prepared for each prediction mode so as to correspond to arectangular block.

The foregoing is the outline of the moving-picture encoding apparatus100 according to the present embodiment.

Next, a syntax structure in the moving-picture encoding apparatus 100according to the present embodiment will be described. FIG. 16 shows anexample of slice header syntax 1106 according to the present embodiment.slice_uni_directional_transform_flag shown in FIG. 16 is a syntaxelement indicating whether an orthogonal transformation where adirection is taken into account should be used for the slice. Asslice_uni_directional_transform_flag is the same as that described inthe first embodiment, explanation thereof is omitted.

slice_bipred_intra_flag shown in FIG. 16 is a syntax element indicatingwhether bi-directional intra-prediction is used for the slice. If theslice_bipred_intra_flag is 0, the intra-prediction image generator 108cannot use the bi-directional intra-prediction image generator 1402. Inthis case, the prediction-selecting switch 1404 connects its outputterminal to the unidirectional intra-prediction image generator 1401regardless of prediction mode 128.

Conversely, if slice_bipred_intra_flag is 1, the prediction-selectingswitch 1404 in the intra-prediction image generator 108 can select theunidirectional intra-prediction image generator 1401 and thebi-directional intra-prediction image generator 1402 according to theprediction mode 128.

FIG. 17 shows an example of macroblock layer syntax 1108 according tothe embodiment. bipred_intra_flag shown in FIG. 17 is a syntax elementindicating whether to use bi-directional intra-prediction in the microblock. bipred_intra_flag is encoded only when slice_bipred_intra_flag is1 and the encoding type of the macroblock is intra-prediction. Ifbipred_intra_flag is 0, the intra-prediction image generator 108 for themacroblock cannot use the bi-directional intra-prediction imagegenerator 1402. In this case, the prediction-selecting switch 1404connects its output terminal to the unidirectional intra-predictionimage generator 1401 regardless of the prediction mode 128.

Conversely, if bipred_intra_flag is 1, the prediction-selecting switch1404 in the intra-prediction image generator 108 for this macroblock canselect the unidirectional intra-prediction image generator 1401 and thebi-directional intra-prediction image generator 1402 according to theprediction mode 128.

According to the foregoing embodiment, unlike simple unidirectionalprediction, use of bi-directional prediction makes it possible to add,in addition to the advantageous effects in the first embodiment, alinear change in the direction of prediction. Generation of a predictionimage signal corresponding to a luminance change such as gradation in anatural image enables prediction closer to an input image.

Third Embodiment

Next, a third embodiment will be described. The configuration of amoving-picture coding apparatus according to the third embodiment isidentical to that in the first embodiment except for the respectiveinternal structures of an orthogonal transformer 102 and inverseorthogonal transformer 105. Blocks and syntax with the same functions asin the first embodiment are labeled with the same signs and explanationsthereof are omitted.

Here, referring to FIGS. 18 and 20, the orthogonal transformer 102 andinverse orthogonal transformer 105 will be explained. FIG. 18 is a blockdiagram of the orthogonal transformer 102. The orthogonal transformer102 according to the present embodiment includes a third orthogonaltransformer 1801 in addition to the processing blocks shown in FIG. 5. Afirst orthogonal transformer 501 and a second orthogonal transformer1802 perform orthogonal transformations where prediction directions asexpressed by equations (3) and (4) are taken into account. On the otherhand, the third orthogonal transformer 1801 performs, for example, DCT.Transformation basis selection information 129 in this case is shown inFIGS. 19A and 19B. If TransformIdx is 0, a basis-selecting switch 503connects its output terminal to a first orthogonal transformer 501. IfTransformIdx is 1, the basis-selecting switch 503 connects its outputterminal to the second orthogonal transformer 1802. If TransformIdx is2, the basis-selecting switch 503 connects its output terminal to thethird orthogonal transformer 1801.

Here, as an example, it is assumed that the orthogonal transformationbasis of the first orthogonal transformer 501 is designed for a verticalprediction mode (mode 0 in FIG. 3A) and that the orthogonaltransformation basis of the second orthogonal transformer 1802 isdesigned for a horizontal prediction mode (mode 1 in FIG. 3A). Here, ifthe vertical prediction mode is used as a first reference direction,TransformIdx is set at 0 for modes 6 and 8, each of which is regarded asa prediction mode the angle of a prediction direction of which is smallwith respect to the vertical prediction mode. In addition, if thehorizontal prediction mode is used as a second reference direction,TransformIdx is set at 1 for modes 5 and 7, each of which is regarded asa prediction mode the angle of a prediction direction of which is smallwith respect to the horizontal prediction mode. TransformIdx is set at 2for modes 3 and 4, each of which is regarded as a prediction mode theangle of a prediction direction of which is equal with respect to tworeference directions, and is also set for mode 2 (DC prediction), theprediction direction of which cannot be defined.

An intra-prediction classifying unit 112 compares a first angle formedby the prediction direction of intra-prediction mode and the firstreference direction (vertical direction), with a second angle formed bythe prediction direction of intra-prediction mode and the secondreference direction (horizontal direction). If the first angle is notlarger than the second angle, the prediction mode is classified into thevertical prediction mode, if the first angle is larger than the secondangle, the prediction mode is classified into horizontal predictionmode.

FIG. 20 is a block diagram of the inverse orthogonal transformer 105.The inverse orthogonal transformer 105 according to the presentembodiment has a third inverse orthogonal transformer 2001 in additionto the processing blocks shown in FIG. 6. Here, a first inverseorthogonal transformer 601 and a second inverse orthogonal transformer2002 perform orthogonal transformations where a direction as expressedby equations (6) and (7) is taken into account. On the other hand, thethird inverse orthogonal transformer 2001 performs, for example, IDCT.Transformation basis selection information 129 in this case is shown inFIGS. 19A and 19B. If TransformIdx is 0, the basis-selecting switch 603connects its output terminal to the first inverse orthogonal transformer601. If TransformIdx is 1, the basis-selecting switch 603 connects itsoutput terminal to the second inverse orthogonal transformer 2002. IfTransformIdx is 2, the basis-selecting switch 603 connects its outputterminal to the third inverse orthogonal transformer 2001.

The present embodiment uses three orthogonal transformations. Amongthese, each of the first and second orthogonal transformers performs anorthogonal transformation using an orthogonal transformation basis wherea direction is taken into account. As reference directions forprediction mode, the vertical and horizontal prediction modes forming a90-degree angle between them are provided as reference directions forprediction modes, and a prediction mode that forms an angle of less than90 degrees with respect to each of these is classified into using thesame orthogonal transformation. Classifying an orthogonal transformationby use of correlation in a spatial direction in such a manner enablesencoding such that coefficient density is improved in an orthogonaltransformation where a direction is taken into account.

In the present embodiment, a description has been given of a system inwhich switching is performed between the first, second, and thirdorthogonal transformations and between the first, second, and thirdinverse orthogonal transformations according to prediction modeclassification. However, the number of these can be increased. In thiscase, hardware and so on may be required for different orthogonal andinverse orthogonal transformations. However, selecting a combinationthat satisfies the balance between circuit scale and encoding efficiencywill suffice.

Additionally, it is possible to provide a configuration for amoving-picture encoding apparatus that is a combination of the secondand third embodiments.

In addition to the advantageous effects of the first embodiment, thethird embodiment provides, as reference directions for prediction mode,vertical and horizontal prediction modes that together form a 90-degreeangle, and classifies a prediction mode forming an angle of less than 90degrees with respect to each of these as using the same orthogonaltransformation. Classifying an orthogonal transformation by use ofcorrelation in a spatial direction in such a manner enables coding suchthat coefficient density is improved in an orthogonal transformationwhere a direction is taken into account.

Fourth Embodiment

Next, a fourth embodiment will be described. The configuration of amoving-picture coding apparatus according to the fourth embodiment isidentical to that in the first embodiment except for the respectiveinternal structures of an orthogonal transformer 102 and inverseorthogonal transformer 105. Blocks and syntax with the same functions asin the first embodiment are labeled with the same signs and explanationsthereof are omitted.

Here, referring to FIGS. 23 and 24, the orthogonal transformer 102 andinverse orthogonal transformer 105 will be explained. FIG. 23 is a blockdiagram of the orthogonal transformer 102. The orthogonal transformer102 according to the present embodiment includes first and secondorthogonal transformers 2301 and 2302 that are altered forms of theprocessing blocks shown in FIG. 5, and also includes third and fourthorthogonal transformers 2303 and 2304. Here, the first to fourthorthogonal transformers 2301 to 2304 perform orthogonal transformationswhere predictive residual generated according to a prediction direction,as expressed by equations (3) and (4), is taken into account. One of thefirst to fourth orthogonal transformers 2301 to 2304 may be replacedwith DCT or the like. Transformation basis selection information 129 inthis case is shown in FIGS. 25A and 25B. In the table in FIG. 25A, itemsof the information 129 are classified according to the tendency for apredictive residual generated according to a predicted error. In thiscase, the prediction modes are classified into four types according topixel lines referred to in intra-prediction. For example, definitionsare made as follows: DC prediction (prediction mode 2), the predictiondirection of which cannot be defined, is TransformIdx=3; predictionmodes 0, 3, and 7 that use only a vertical reference pixel line areTransformIdx=1; prediction modes 1 and 8 that use only a horizontalreference pixel line are TransformIdx=2; and prediction modes 4, 5, and6 that use two reference pixel lines, i.e., vertical and horizontal, areTransformIdx=0.

If TransformIdx is 0, a basis-selecting switch 503 connects its outputterminal to the first orthogonal transformer 2301. If TransformIdx is 1,the basis-selecting switch 503 connects its output terminal to thesecond orthogonal transformer 2302. If TransformIdx is 2, thebasis-selecting switch 503 connects its output terminal to the thirdorthogonal transformer 2303. If TransformIdx is 3, the basis-selectingswitch 503 connects its output terminal to the fourth orthogonaltransformer 2304.

Here, an orthogonal transformation basis for TransformIdx=0 is designedfrom predictive residual of prediction modes 4, 5, and 6 categorized asthe same type, an orthogonal transformation basis for TransformIdx=1 isdesigned from prediction residual of the prediction modes 0, 3, and 7,an orthogonal transformation basis for TransformIdx=2 is designed fromthe prediction residual of the prediction modes 1 and 8, and anorthogonal transformation basis for TransformIdx=3 is designed from theprediction residual of the DC prediction (prediction mode 2). Here, adescription has been given of an example where the fourth orthogonaltransformer 2304 corresponding to TransformIdx=3 performs an orthogonaltransformation based on the DCT.

FIG. 24 is a block diagram of the inverse orthogonal transformer 105.The inverse orthogonal transformer 105 according to the presentembodiment includes first and second inverse orthogonal transformers2401 and 2402 that are altered forms of the processing blocks shown inFIG. 6, and also includes third and fourth inverse orthogonaltransformers 2403 and 2404. Here, the first to fourth inverse orthogonaltransformers 2401 to 2404 perform orthogonal transformations wherepredictive residual generated according to prediction directions, asexpressed by equations (6) and (7), is taken into account. One of thefirst to fourth inverse orthogonal transformers 2401 to 2404 may bereplaced with DCT or the like.

Transformation basis selection information 129 in this case is shown inFIGS. 25A and 25B. If TransformIdx is 0, a basis-selecting switch 603connects its output terminal to the first inverse orthogonal transformer2401. If TransformIdx is 1, the basis-selecting switch 603 connects itsoutput terminal to the second inverse orthogonal transformer 2402. IfTransformIdx is 2, the basis-selecting switch 603 connects its outputterminal to the third inverse orthogonal transformer 2403. IfTransformIdx is 3, the basis-selecting switch 603 connects its outputterminal to the fourth inverse orthogonal transformer 2404.

The present embodiment uses four orthogonal transformations. Of these,each of the first and fourth orthogonal transformers performs anorthogonal transformation by use of an orthogonal transformation basisin which the correlation between predictive residuals generatedaccording to a prediction direction are taken into account. At thistime, classifying orthogonal transformations according to referencepixel lines, along which prediction pixels are formed, enables encodingsuch that coefficient density is improved in an orthogonaltransformation.

In the present embodiment, a description has been given of a system inwhich switching is performed between the first, second, third and fourthorthogonal transformations and between the first, second, third, andfourth inverse orthogonal transformations according to prediction modeclassification. However, the number of these may be decreased orincreased. In this case, hardware and so on may be required fordifferent orthogonal and inverse orthogonal transformations. However,selecting a combination that satisfies the balance between circuit scaleand encoding efficiency will suffice. Additionally, it is possible toprovide a configuration for a moving-picture encoding apparatus that isa combination of the second and fourth embodiments.

In the fourth embodiment, a description was given of a system in whichswitching is performed between the four types of orthogonaltransformation and between the four types of inverse orthogonaltransformation according to prediction mode classification. However,sharing an orthogonal transformation matrix in a transformation and inan inverse orthogonal transformation can further reduce circuit scale inthe realization of hardware. For example, matrices A and B or matrices Cand D in a separable two dimensional transformation expressed by theequations (3) or (4) respectively can be used according to predictionmode. Examples of these are shown in FIGS. 26A, 26B, and 26C, which showa combination of one dimensional transformations corresponding to thematrices A and B in the equation (3), (this is the same for thecombination of one dimensional transformations corresponding to thematrices C and D in the equation (4)). For example, if TransformIdx=0,it indicates that common 1D TransformMatrix α is used for the matrices Aand B in the equation (3). Sharing such a transformation matrix enablesa reduction in transformation matrices such that the need to prepare fortwo types of transformation matrix for each orthogonal transformer oreach inverse orthogonal transformer is eliminated. For example, sincethe present embodiment has four types of (inverse) orthogonaltransformer, eight types of transformation matrix are required. However,only two types of transformation matrix can suffice for four types of(inverse) transformation. Similarly, sharing is also possible in areverse transformation as expressed by the equations (6) and (7).

According to the foregoing fourth embodiment, in addition to theadvantageous effects in the first embodiment, the use of the four typesof orthogonal transformation basis where correlation between predictiveresiduals generated according to a prediction direction is taken intoaccount enables orthogonal and inverse orthogonal transformations suchthat circuit scale in the realization of hardware is reduced whilecoefficient density is further improved.

Additionally, where four types of orthogonal transformation are used byorthogonal transformers taking into account the prediction direction ofintra-prediction as in the embodiment, the prediction modes 4, 5, and 6,for example, are forcibly assigned to TransformIdx=0. Accordingly, thedegree of concentration of electric power is not always high, unlikewhere zigzag scanning order in H.264 is used. For this reason, theproperty such that, in each prediction mode, the tendencies to generatenon-zero transformation coefficients are similar is utilized so that inthe 2D-1D transformation, entropy encoding is preferentially performedstarting with a transformation coefficient located where the probabilityof generation of a non-zero transformation coefficient is highest, thusenabling a decrease in information required for encoding transformationcoefficients.

Next will be described fifth to eighth embodiments according to amoving-picture decoding apparatus.

Fifth Embodiment

FIG. 21 shows a moving-picture decoding apparatus according to the fifthembodiment. A moving-picture decoding apparatus 2100 in FIG. 21 decodescoded data generated by the moving-picture encoding apparatus accordingto, for example, the first embodiment.

The moving-picture decoding apparatus 2100 in FIG. 21 decodes coded data2114 stored in an input buffer 2101 and outputs a decoded image signal2119 to an output buffer 2112. The coded data 2114 is transmitted from,for example, a moving-picture encoding apparatus 100, transmittedthrough an accumulation system or transmission system (not shown),stored once in the input butter 2101 and multiplexed.

The moving-picture decoding apparatus 2100 includes an entropy decoder2102, a coefficient order controller 2103, an inverse quantizer 2104, aninverse orthogonal transformer 2105, an adder 2106, a reference imagememory 2107, an intra-prediction image generator 2108, aninter-prediction image generator 2109, a prediction-selecting switch2110, and an intra-prediction classifying unit 2111. The moving-picturedecoding apparatus 2100 is connected to an input buffer 2101, an outputbuffer 2112, and a decoding controller 2113.

The entropy decoder 2102 interprets the coded data 2114 by parsing basedon the syntax of an each frame or field. The entropy decoder 2102entropy-decodes the sequences of syntactic symbols of in order, therebyreproducing prediction information 2124, sequence of quantizedtransformation coefficients 2115, coded parameters of a coded targetblock, etc. The coded parameters include all parameters required fordecoding, such as information about prediction and information aboutquantization.

The sequence of quantized transformation coefficients 2115 interpretedby the entropy decoder 2102 is input to the coefficient order controller2103. Also, a prediction mode 2121 included in prediction information2124 is input to the coefficient order controller 2103. The coefficientorder controller 2103 has the function of transforming the sequence ofquantized transformation coefficients 2115, which is one dimensionaldata, into two dimensional data. The sequence of quantizedtransformation coefficients 2115, transformed by the coefficient ordercontroller 2103, is input to the inverse quantizer 2104 in the form ofquantized transformation coefficients 2116. The inverse quantizer 2104performs inverse quantization based on information about interpretedquantization, thereby decoding transformation coefficients. Thequantized transformation coefficients 2116 decoded by the inversequantizer 2104 are input to the inverse orthogonal transformer 2105 inthe form of inversely quantized transformation coefficients 2117. In theinverse orthogonal transformer 2105, the function of which is describedbelow, an inverse discrete cosine transformation (IDCT) for example isperformed based on transformation basis selection information 2122 inputfrom the intra-prediction classifying unit 2111.

A decoded predictive residual signal 2118 generated by its beingsubjected to an inverse orthogonal transformation by the inverseorthogonal transformer 2105 is input to the adder 2106. The adder 2106adds the decoded predictive residual signal 2118 and a prediction imagesignal 2123 output from the prediction-selecting switch 2110 (describedbelow), thereby generating a decoded image signal 2119.

The decoded image signal 2119 thus generated is input to a referenceimage memory 2107. The reference image memory 2107 outputs the inputdecoded image signal 2119 to the output buffer 2112 and holds thedecoded image signal 2119 in its internal memory as a reference imagesignal 2120, and uses this reference signal 2120 for the process ofgenerating a prediction image signal, which is performed subsequently.The decoded image signal 2119 output from the reference image memory2107 is output from the moving-picture decoding apparatus 2100, isstored once in the output buffer 2112, and then output at output timingmanaged by the decoding controller 2113.

The reference image signals 2120 are read from the reference imagememory 2107 sequentially for each frame or each field, and are input tothe intra-prediction image generator 2108 or the inter-prediction imagegenerator 2109.

The intra-prediction image generator 2108 in FIG. 21 has the same unitsand function as the intra-prediction image generator 108 in themoving-picture encoding apparatus 100 in FIG. 1. Therefore, explanationof this unit is omitted.

The inter-prediction image generator 2109 in FIG. 21 has the same unitsand function as the inter-prediction image generator 109 shown inFIG. 1. Therefore, explanation of this unit is also omitted.

Next, the coefficient order controller 2103 will be described in detail.FIG. 22 is a block diagram of the coefficient order controller 2103. Thecoefficient order controller 2103 has a prediction-mode selecting switch2201 and nine types of 1D-2D transformers 2202 to 2210. Theprediction-mode selecting switch 2201 connects its output terminal tothe 1D-2D transformers according to the mode number of each predictionmode shown on the left-hand side of FIG. 7A. For instance, if predictionmode 0 is input, the prediction-mode selecting switch 2201 connects theoutput terminal to the vertical 1D-2D transformer 2202. The predictionmodes correspond one to one to the 1D-2D transformers such that eachprediction mode is always connected to the corresponding 1D-2Dtransformer. The prediction modes correspond one to one to the ninetypes of 1D-2D transformer 2202 to 2210 such that an output terminal isselected for each prediction mode.

The nine types of 1D-2D transformer 2202 to 2210 have the function oftransforming into two dimensional data the one dimensional data of thesequence of decoded quantized transformation coefficients 2115. Forexample, in H.264, one dimensional data is transformed into twodimensional data by zigzag scanning.

FIGS. 4A and 4B show an example of transforming one dimensional data in4×4 blocks into two dimensional data by use of zigzag scanning.Specifically, they show an example where the series of interpretedquantized transformation coefficients 2115 (corresponding to FIG. 4B) istransformed into two dimensional data (corresponding to FIG. 4A) byinverse zigzag scanning. If each component of the quantizedtransformation coefficients 2116 is represented by cij, a 1D-2Dtransformation using an inverse zigzag scanning yields results as shownin FIG. 4C, in which idx represents the index of the one dimensionaldata before a 1D-2D transformation.

Here, the nine types of 1D-2D transformers 2202 to 2210 use differentscanning orders according to each of prediction modes 2121. FIG. 9 showsthe relation between prediction modes for a 4×4-pixel block and scanningorders. A different scanning order is selected according to the numberof the IntraN×NPredModeIndex shown in FIG. 7A. A description has beengiven using, as an example, a 4×4-pixel block. However, similarly, an8×8- or 16×16-pixel block can also select scanning orders that differaccording to each prediction mode. Where a pixel block is a rectangularblock represented by M×N, M×N may be used as a block size for a 1D-2Dtransformation. In this case, a table of scanning orders for thecorresponding prediction modes, as shown in FIG. 9, may be used for therectangular block.

Next, the intra-prediction classifying unit 2111 will be described. Theintra-prediction classifying unit 2111 has the function of generatingtransformation basis selection information 2122 used in an inverseorthogonal transformation, based on prediction mode 2121 included inprediction information 2124 interpreted by the entropy decoder 2102. Inthis case, using classification tables shown in FIGS. 7A and 7B,prediction modes are classified into two groups, and transformationbasis selection information 2122 expressed by TransformIdx is set foreach of the prediction modes classified. IntraN×NPredModeIndex shown inthe table indicates the prediction mode 2121. N is an index indicating ablock size such that 4 indicates a 4×4-pixel block; 8, an 8×8-pixelblock; and 16, a 16×16-pixel block, and correspondingly for any blocksize other than these. The description has been given using, as anexample, a square block represented by N×N. However, it is easy toextend a block size to a rectangular block represented by M×N.

Where TransformIdx is 0, this indicates use of the first inverseorthogonal transformation. Where TransformIdx is 1, this indicates theuse of the second inverse orthogonal transformation. In this case, if apixel block is a rectangular block represented by M×N, M×N may be usedas a block size for an inverse orthogonal transformation.

Here, TransformIdx is set at 1 only for DC prediction (corresponding toprediction mode 2), and TransformIdx is set at 0 for prediction modesthat have other spatial prediction directions.

The inverse orthogonal transformer 2105 has the same function as theinverse orthogonal transformer 105 in FIG. 6. Here, the inverselyquantized transformation coefficients 122, transformation basisselection information 129, and restored predictive residual signal 123in FIG. 6 correspond to the inversely quantized transformationcoefficients 2117, transformation basis selection information 2122,restored predictive residual signal 2118 in FIG. 21 respectively. As theinverse orthogonal transformers 105 and 2105 shown in FIGS. 6 and 21respectively have the same function, explanation thereof is omittedhere.

Using equation (6) or (7), the first inverse orthogonal transformer ofthe inverse orthogonal transformer 2105 performs an inverse orthogonaltransformation process for inversely quantized transformationcoefficients 2117. The inverse orthogonal transformer 2105 performs theinverse orthogonal transformation process using, for example, atransformation matrix designed using horizontal prediction (mode 1).Using the equation (6) or (7), the second inverse orthogonal transformerof the inverse orthogonal transformer 2105 performs an inverseorthogonal transformation process for the inversely quantizedtransformation coefficients 2117. The inverse orthogonal transformationmay be IDCT. In either case, an inverse orthogonal transformation isperformed using a transformation matrix corresponding to the orthogonaltransformation used in the first embodiment.

The foregoing description is an outline of the moving-picture decodingapparatus 2100 according to the fifth embodiment.

Next, a syntax structure for coded data that the moving-picture decodingapparatus 2100 decodes will be described. The coded data 2114 that themoving-picture decoding apparatus 2100 decodes may have the same syntaxstructure as that in the moving-picture encoding apparatus 100. Here, itis assumed to use the same syntax as that shown in FIG. 12 or 13, anddetailed explanation thereof is omitted.

FIG. 12 shows an example of slice header syntax 1106 according to thepresent embodiment. slice_uni_directional_transform_flag shown in FIG.12 is a syntax element indicating whether an orthogonal transformationwhere a direction is taken into account should be used for the slice. Ifslice_uni_directional_transform_flag is 0, the orthogonal transformer102 and inverse orthogonal transformer 105 cannot use the firstorthogonal transformer 501 and first inverse orthogonal transformer 601respectively. In this case, the basis-selecting switch 503 connects itsoutput terminal to the second orthogonal transformer 502 regardless oftransformation basis selection information 129, and also thebasis-selecting switch 603 connects its output terminal to the secondinverse orthogonal transformer 602 regardless of transformation basisselection information 129. In this case also, the coefficient ordercontroller 113 can use only 2D-1D transformer 804 for DCT. In this case,the prediction-mode selecting switch 801 connects its output terminal tothe 2D-1D transformer 804 for DCT regardless of prediction mode 128.

Conversely, if the slice_uni_directional_transform_flag is 1, theencoding process is performed following the encoding flowchartsillustrated in FIGS. 10A and 10B. Specifically, the orthogonaltransformer 102 selects the first or second orthogonal transformer 501according to transformation basis selection information 129, and alsothe inverse orthogonal transformer 105 selects the first or secondinverse orthogonal transformer 601 or 602 according to thetransformation basis selection information 129. The prediction modeselecting switch 801 can connect its output terminal to the 2D-1Dtransformers 802 to 810 according to the prediction mode 128.

FIG. 13 shows an example of macroblock layer syntax 1108 according toanother embodiment. mb_uni_directional_transform_flag shown in FIG. 13is a syntax element indicating whether an orthogonal transformationwhere a direction is taken into account should be used for themacroblock. mb_type in FIG. 13 indicates the encoding type of the codedmacroblock. I_N×N indicates that the encoding type is intra-perditionencoding and that the prediction block size is N×N. N includes 32, 64,etc., as well as 4, 8, and 16. mb_uni_directional_transform_flag iscoded only when slice_uni_directional_transform_flag is 1 and theencoding type of the macroblock is intra-prediction. If themb_uni_directional_transform_flag is 0, the orthogonal transformer 102and the inverse orthogonal transformer 105 cannot use the firstorthogonal transformer 501 and the first inverse orthogonal transformer601 respectively. In this case, the basis-selecting switch 503 connectsits output terminal to the second orthogonal transformer 502 regardlessof the transformation basis selection information 129, and also thebasis-selecting switch 603 connects its output terminal to the secondinverse orthogonal transformer 602 regardless of the transformationbasis selection information 129. In this case also, the control ordercontroller 113 can use only the 2D-1D transformer 804 for DCT. In thiscase, the prediction-mode selecting switch 801 connects its outputterminal to the 2D-1D transformer 804 for DCT regardless of theprediction mode 128.

On the other hand, if mb_uni_directional_transform_flag is 1, theencoding process is performed following the encoding flowchartsillustrated in FIGS. 10A and 10B. Specifically, the orthogonaltransformer 102 selects the first or second orthogonal transformer 501or 502 according to the transformation basis selection information 129,and also the inverse orthogonal transformer 105 selects the first orsecond inverse orthogonal transformer 601 or 602 according to thetransformation basis selection information 129. The prediction modeselecting switch 801 can connect its output terminal to the 2D-1Dtransformers 802 to 810 according to the prediction mode 128.

Encoding the flag, which indicates whether the orthogonal transformationwhere a direction is taken into account should be used in a macroblocklayer, increases the amount of information relating to transformationselection, but enables the optimum orthogonal transformation for eachlocal area of an image.

A syntax element that is not defined in the present embodiment may beinserted between the lines in the table of syntax shown in each of FIGS.12 and 13, and description relating to any other conditional branch maybe included between them. Additionally, the syntax table may be dividedinto a plurality of sub-tables or a plurality of syntax tables may beintegrated. The same terms do not have to be used but may arbitrarily bechanged according to the embodiment employed.

According to the foregoing fifth embodiment, classifying predictiondirections of an intra-prediction mode according to correlations betweenpredictive residuals, and performing an inverse orthogonaltransformation improves coefficient density after a transformation andenables a reduction in hardware mounting circuit scale.

Sixth Embodiment

Next, a sixth embodiment will be described. The configuration of amoving-picture decoding apparatus according to the sixth embodiment isidentical to that in the fifth embodiment. A moving-picture decodingapparatus 2100 according to the sixth embodiment decodes coded datagenerated by the moving-picture encoding apparatus according to thesecond embodiment. Blocks and syntax with the same functions as in thefifth embodiment are labeled with the same signs and explanationsthereof are omitted. The sixth embodiment is different from the fifthembodiment only in the internal structure of an intra-prediction imagegenerator 2108.

Here, the intra-prediction generator 2108 is explained with reference toFIG. 14. FIG. 14 is a block diagram of the intra-prediction generator2108(108). The prediction mode 128, prediction image signal 127, andreference image signal 125 in FIG. 14 correspond to the prediction mode2121, prediction image signal 2123, and reference image signal 2120 inFIG. 21 respectively.

The intra-prediction image generator 2108 (108) according to the presentembodiment includes a unidirectional intra-prediction image generator1401, a bi-directional intra-prediction image generator 1402, aprediction-mode generator 1403, and a prediction-selecting switch 1404.

The intra-prediction image generator 108 in the first embodiment hasneither the bi-directional intra-prediction image generator 1402 nor theprediction-selecting switch 1404 shown in FIG. 14. As a description ofthe processing content of the unidirectional intra-prediction imagegenerator 1401 has been given in the first embodiment with reference toFIGS. 3A to 4C, this description is omitted here.

The bi-directional intra-prediction image generator 1402 generates twounidirectional intra-prediction image signals and subjects them toweighted averaging, thereby generating an image signal 127.Bi-directional prediction using horizontal prediction and orthogonalright downward prediction shown in FIGS. 3C and 3D, for example, willnow be described. First, each unidirectional prediction image signal isgenerated. Here, if horizontal prediction and orthogonal right downwardprediction are P1[x, y] and P2[x, y] respectively, a prediction imagesignal P[x, y] for bi-directional prediction is expressed by theequation (10). FIG. 15 shows the prediction numbers for bi-directionalintra-predictions, a combination of two uni-directions, andtransformation basis information.

Next, the function of the prediction mode generator 1403 will bedescribed. Prediction information 2124 interpreted by an entropy decoder2102 is held in and controlled by a decoding controller 2113. Here,where bi-directional intra-prediction is selected as predictioninformation included in the prediction information 2124, theprediction-mode generator 1403 derives the prediction mode 2121 inbi-directional intra-prediction according to the table shown in FIG. 15,and outputs the mode. The prediction-selecting switch 1404 connects itsoutput terminal to the intra-prediction image generators 1401 and 1402according to the input prediction mode 2121. Here, if bipred_intra_flagis 0, the switch connects its output terminal to the unidirectionalintra-prediction image generator 1401. If bipred_intra_flag is 1, theswitch connects its output terminal to the bi-directionalintra-prediction image generator 1402.

The foregoing is a description of the intra-prediction image generator2108 (108) according to the present embodiment.

Next will be described the intra-prediction classifying unit 2111. Theintra-prediction classifying unit 2111 in FIG. 21 has the same functionas the intra-prediction classifying unit 112 according to the secondembodiment. The intra-prediction classifying unit 2111 has the functionof generating, based on input prediction mode 2121, transformation basisselection information 2122, which is used for an inverse orthogonaltransformation. That is, the intra-prediction classifying unit 2111generates transformation basis selection information 2122 based onprediction mode 2121 input from the intra-prediction image generator2108. Here, using the classification tables shown in FIGS. 7A and 15,the prediction modes are classified into two, and transformation basisselection information 129 expressed by TransformIdx is set for each ofthe prediction modes classified.

Next, a coefficient order controller 2103 will be described.TransformIdx is determined by the mode number expressed inIntraN×NPredModeIndexL0. IntraN×NPredModeIndexL0 indicates aunidirectional intra-prediction mode and is given nine types ofprediction modes.

Here, nine types of 1D-2D transformers 2202 to 2210 use scanning ordersdiffering according to a prediction mode 2121. FIG. 9 shows the relationbetween a prediction mode and a scanning order in a 4×4-pixel block.According to the number for IntraN×NPredModeINdexL0 in FIG. 15, adifferent scanning order is selected. Here, a description has been givenof an example for a 4×4-pixel block. However, similarly, an 8×8- or16×16-pixel block can select different scanning orders according to aprediction mode. In the case where a pixel block is a rectangular blockexpressed by M×N, M×N may be used as a block size for a 2D-1Dtransformation. In this case, a scanning order table as shown in FIG. 9may be prepared for each prediction mode so as to correspond to arectangular block.

FIG. 16 shows an example of slice header syntax 1106 according to thepresent embodiment. slice_uni_directional_transform_flag shown in FIG.16 is a syntax element indicating whether an orthogonal transformationwhere a direction is taken into account should be used for the slice. Asslice_uni_directional_transform_flag is the same as that described inthe first embodiment, explanation thereof is omitted.

slice_bipred_intra_flag shown in FIG. 16 is a syntax element indicatingwhether bidirectional intra-prediction is used for the slice. Ifslice_bipred_intra_flag is 0, the intra-prediction image generator 108cannot use the bi-directional intra-prediction image generator 1402. Inthis case, the prediction-selecting switch 1404 connects its outputterminal to the unidirectional intra-prediction image generator 1401regardless of the prediction mode 128.

Conversely, if slice_bipred_intra_flag is 1, the prediction-selectingswitch 1404 in the intra-prediction image generator 108 can selectunidirectional intra-prediction image generator 1401 and bi-directionalintra-prediction image generator 1402 according to the prediction mode128.

FIG. 17 shows an example of macroblock layer syntax 1108 according tothe embodiment. bipred_intra_flag shown in FIG. 17 is a syntax elementindicating whether to use bi-directional intra-prediction in themacroblock. bipred_intra_flag is encoded only whenslice_bipred_intra_flag is 1 and the encoding type of the macroblock isintra-prediction. If bipred_intra_flag is 0, the intra-prediction imagegenerator 108 for the macroblock cannot use the bi-directionalintra-prediction image generator 1402. In this case, theprediction-selecting switch 1404 connects its output terminal to theunidirectional intra-prediction image generator 1401 regardless of theprediction mode 128.

Conversely, if bipred_intra_flag is 1, the prediction-selecting switch1404 in the intra-prediction image generator 108 for this macroblock canselect the unidirectional intra-prediction image generator 1401 and thebi-directional intra-prediction image generator 1402 according to theprediction mode 128.

The foregoing sixth embodiment can decode coded data generated by themoving-picture encoding apparatus according to the second embodiment, inaddition to the advantageous effects of the fifth embodiment.

Seventh Embodiment

Next, a seventh embodiment will be described. The configuration of amoving-picture decoding apparatus according to the seventh embodiment isidentical to that in the fifth embodiment. A moving-picture decodingapparatus 2100 according to the seventh embodiment decodes coded datagenerated by the moving-picture encoding apparatus according to thethird embodiment. Blocks and syntax with the same functions as in thefifth embodiment are labeled with the same signs and explanationsthereof are omitted. The seventh embodiment differs from the fifthembodiment only in the internal configuration of an inverse orthogonaltransformer 2105.

Here, referring to FIG. 20, the orthogonal transformer 2105 will beexplained. The inverse orthogonal transformer 105 in FIG. 20 has thesame function as the inverse orthogonal transformer 2105 in FIG. 21. Theinversely-quantized transformation coefficients 122, transformationbasis-selecting information 129, and restored predictive residual signal123 in FIG. 20 correspond to inversely-quantized transformationcoefficients 2117, transformation basis-selecting information 2122, andrestored predictive residual signal 2118 in FIG. 21 respectively.

FIG. 20 is a block diagram of the orthogonal transformer 2105(105). Theorthogonal transformer 2105(105) according to the present embodimentincludes a third orthogonal transformer 2001 in addition to theprocessing blocks shown in FIG. 6. The first inverse orthogonaltransformer 601 and the second inverse orthogonal transformer 602perform inverse orthogonal transformations where a prediction directionas expressed by equations (6) and (7) is taken into account. On theother hand, the third inverse orthogonal transformer 2001 performs, forexample, IDCT. The transformation basis selection information 2122 inthis case is shown in FIGS. 19A and 19B. If TransformIdx is 0, abasis-selecting switch 603 connects its output terminal to the firstinverse orthogonal transformer 601. If TransformIdx is 1, thebasis-selecting switch 603 connects its output terminal to the secondinverse orthogonal transformer 602. If TransformIdx is 2, thebasis-selecting switch 603 connects its output terminal to the thirdorthogonal transformer 2001.

Incidentally, it is possible to provide a configuration for amoving-picture decoding apparatus that is a combination of the sixth andseventh embodiments.

The foregoing seventh embodiment can decode coded data generated by themoving-picture encoding apparatus according to the third embodiment, inaddition to the advantageous effects of the fifth embodiment.

Eighth Embodiment

Next, an eighth embodiment will be described. The configuration of amoving-picture decoding apparatus according to the eighth embodiment isidentical to that in the fifth embodiment. A moving-picture decodingapparatus 2100 according to the eighth embodiment decodes coded datagenerated by the moving-picture encoding apparatus according to thefourth embodiment. Blocks and syntax with the same functions as in thefifth embodiment are labeled with the same signs and explanationsthereof are omitted. The eighth embodiment differs from the fifthembodiment only in the internal configuration of an inverse orthogonaltransformer 2105.

Here, referring to FIG. 24, the orthogonal transformer 2105 will beexplained. The inverse orthogonal transformer 105 in FIG. 24 has thesame function as the inverse orthogonal transformer 2105 in FIG. 21. Theinversely-quantized transformation coefficients 122, transformationbasis-selecting information 129, and restored predictive residual signal123 in FIG. 20 correspond to inversely-quantized transformationcoefficients 2117, transformation basis-selecting information 2122, andrestored predictive residual signal 2118 in FIG. 21 respectively.

FIG. 24 is a block diagram of the inverse orthogonal transformer2105(105). The inverse orthogonal transformer 2105(105) according to thepresent embodiment includes the first and second inverse orthogonaltransformers 2401 and 2402, which are altered forms of the processingblocks shown in FIG. 6, and also includes third and fourth inverseorthogonal transformers 2403 and 2404. Here, the first to fourth inverseorthogonal transformers 2401 to 2404 perform inverse orthogonaltransformations where predictive residual generated according to aprediction direction, as expressed by equations (6) and (7), is takeninto account. One of the first to fourth inverse orthogonal transformers2401 to 2404 may be replaced with IDCT or the like.

The transformation basis selection information 129 in this case is shownin FIGS. 25A and 25B. If TransformIdx is 0, a basis-selecting switch 603connects its output terminal to the first inverse orthogonal transformer2401. If TransformIdx is 1, the basis-selecting switch 603 connects itsoutput terminal to the second inverse orthogonal transformer 2402. IfTransformIdx is 2, the basis-selecting switch 603 connects its outputterminal to the third inverse orthogonal transformer 2403. IfTransformIdx is 3, the basis-selecting switch 603 connects its outputterminal to the fourth inverse orthogonal transformer 2404.

The present embodiment uses four inverse orthogonal transformations.With regard to these, each of the first and fourth inverse orthogonaltransformers performs an inverse orthogonal transformation by use of anorthogonal transformation basis in which the correlation betweenpredictive residuals generated according to a prediction direction istaken into account. At this time, classifying inverse orthogonaltransformations according to reference pixel lines, along whichprediction pixels are formed, enables encoding such that coefficientdensity is high.

In the present embodiment, a description has been given of a system inwhich switching is performed between the first, second, third and fourthorthogonal transformations and between the first, second, third, andfourth inverse orthogonal transformations according to prediction modeclassification. However, the number of these may be increased. In thiscase, hardware and so on may be required for different inverseorthogonal transformations. However, selecting a combination thatsatisfies the balance between circuit scale and encoding efficiency willsuffice. Additionally, it is possible to provide a configuration for amoving-picture decoding apparatus that is a combination of the sixth andeighth embodiments.

In the eighth embodiment, a description was given of a system in whichswitching is performed between the four types of inverse orthogonaltransformations according to prediction mode classification. However,sharing an orthogonal transformation matrix in an inverse orthogonaltransformation can further reduce circuit scale in the realization ofhardware. For example, matrices A and B or matrices C and D in aseparable two dimensional inverse orthogonal transformation expressed bythe equations (6) or (7) respectively can be used according toprediction mode. Examples of these are shown in FIGS. 26A, 26B, and 26C,which show a combination of one dimensional transformationscorresponding to the matrices A and B in the equation (6), (this is thesame for the combination of one dimensional transformationscorresponding to the matrices C and D in the equation (7)). For example,if TransformIdx=0, it indicates that common 1D TransformMatrix α is usedfor the matrices A and B in the equations (6). Sharing such atransformation matrix enables a reduction in transformation matricessuch that the need to prepare for two types of transformation matrix foreach inverse orthogonal transformer is eliminated. For example, sincethe present embodiment has four types of inverse orthogonal transformer,eight types of transformation matrix are required. However, only twotypes of transformation matrix can suffice for four types of inverseorthogonal transformation.

The forgoing eighth embodiment can decode coded data generated by themoving-picture encoding apparatus according to the fourth embodiment, inaddition to the advantageous effects of the fifth embodiment.

(Modified Examples of the First to Eighth Embodiments)

(1) A syntax element that is not defined in the present embodiment maybe inserted between the lines in the table of syntax shown in each ofFIGS. 12, 13, 16, and 17 and description relating to any otherconditional branch may be included between them. Additionally, thesyntax table may be divided into a plurality of sub-tables or aplurality of syntax tables may be integrated. The same terms do not haveto be used but may arbitrarily be changed according to the embodimentemployed.

(2) In each of the first to eighth embodiments, a description has beengiven of the case where a frame to be processed is divided into squareblocks of 16×16-pixel size, for example, and these blocks areencoded/decoded in order from the left top block of a picture toward theright bottom one, as shown in FIG. 2A. However, encoding and decodingorders are not limited thereto but encoding and decoding orders maystart from the right bottom toward the left top or may lead out from thecenter of a picture in a spiral. Further, encoding and decoding ordersmay start from the right top toward the left bottom or may start fromthe perimeter of a picture toward its center.

(3) In the first to eighth embodiments, a description has been given ofcases where block sizes are a 4×4-, 8×8-, or 16×16-pixel block. However,a block to be estimated does not have to be square but may have anyblock size such as a 16×8-, 8×16-, 8×4-, or 4×8-pixel block.Additionally, even a macroblock does not have to be formed of smallerblocks of equal size but may be composed of smaller blocks of differentsizes. In this case, as the number of divisions increases, the number ofsymbols for encoding or decoding the division information increases. Inthis case, a block size may be selected taking account of the balancebetween the number of symbols for transformation coefficients and thelocal decoded image.

(4) In each of the first to eighth embodiments, a description has beengiven using an example where neither a luminance signal nor acolor-difference signal is divided but only the color signal componentof one of these is divided. However, where a prediction process differsbetween the luminance signal and the color difference signal, they mayuse their respective prediction methods or may use the same predictionmethod. If different prediction methods are used, a prediction methodselected for the color-difference signal is encoded or decoded in thesame manner as for the luminance signal.

(5) In each of the first to eighth embodiments, a description has beengiven using an example where neither a luminance signal nor acolor-difference signal is divided but only the color signal componentof one of these is divided. However, where an orthogonal transformationprocess differs between the luminance signal and the color differencesignal, they may use their respective orthogonal transformation methodsor may use the same orthogonal transformation method. If differentorthogonal transformation methods are used, an orthogonal transformationmethod selected for the color-difference signal is encoded or decoded inthe same manner as for the luminance signal.

The foregoing embodiments not only increase coefficient density after anorthogonal transformation in intra-prediction encoding but also reducecircuit scale in hardware mounting. That is, the foregoing embodimentsyield the advantageous effects that where an orthogonal transformationis realized with hardware, significant increase in circuit scale due touse of dedicated hardware corresponding to each prediction direction isobviated and increasing coefficient density after an orthogonaltransformation improves encoding efficiency and also subjectiveimage-quality.

Instructions given in the processing procedures in the foregoingembodiments can be performed based on software programs. Ageneral-purpose computing system may pre-store the programs and read theprograms, thereby obtaining the same effects as those yielded by themoving-picture encoding and decoding apparatuses according to theforegoing embodiments. The instructions described in the foregoingembodiments are recorded, as programs that can be executed by computers,on a magnetic disk (such as a flexible disk or hardware), an opticaldisk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD±R, or DVD±RW), asemiconductor memory, or a recording media similar to these. A recordingmedia readable by a computer or built-in system may be of any storagetype. A computer may read the programs from such a recording media andcause a CPU to perform instructions, described in the programs, based onthe program, thereby realizing operations just as do the moving-pictureencoding and decoding apparatuses described above. Needless to say,where a computer obtains the programs, these may be obtained or readthrough a network.

Alternatively, some of the processing for realizing each of the presentembodiments may be performed by MW (middleware), such as an OS(Operating System), network, or data base management software; or, whichis operating on a computer based on instructions for each programinstalled in the computer or built-in system from a recording media.

Furthermore, the recording media in the present embodiments is notlimited to one independent computer or built-in system but may also be arecording medium obtained by downloading a program, transmitted by aLAN, the internet, or the like, and storing (or temporarily storing) it.

Alternatively, the recording media are not limited to only one. However,where the present embodiments are performed by a plurality of media,these media are included as recording media of the present embodimentsand may have any configuration.

A computer or built-in system in the present embodiments is used forperforming each processing in the present embodiments based on thecorresponding program stored in a recording medium and may have anyconfiguration, as of a single apparatus such as a personal computer ormicrocomputer or as of a system in which a plurality of apparatuses arenetworked.

Examples of a computer for the present embodiments include not only apersonal computer but also a processor included in an informationprocessing unit, a microcomputer, and so on. They refer to any apparatusor device able to realize the function of the present embodimentsaccording to the programs.

While certain embodiments have been described, these embodiments havebeen presented by way of example only, and are not intended to limit thescope of the inventions. Indeed, the novel embodiments described hereinmay be embodied in a variety of other forms; furthermore, variousomissions, substitutions and changes in the form of the embodimentsdescribed herein may be made without departing from the spirit of theinventions. The accompanying claims and their equivalents are intendedto cover such forms or modifications as would fall within the scope andspirit of the inventions.

What is claimed is:
 1. A moving-picture encoding apparatus, comprising:a prediction unit configured to obtain a predictive residual signal tobe encoded, by using an intra-prediction that corresponds to a modeselected from a plurality of intra-prediction modes; a classifying unitconfigured to classify the selected mode into a first prediction modepreset in intra-prediction modes or a second prediction mode preset inthe intra-prediction modes; a first orthogonal transformer configured toobtain a plurality of first transformation coefficients by subjectingthe predictive residual signal to an orthogonal transformation by use ofa first transformation basis if the selected mode is classified into thefirst prediction mode; a second orthogonal transformer configured toobtain a plurality of second transformation coefficients by subjectingthe predictive residual signal to the orthogonal transformation by useof a second transformation basis different from the first transformationbasis if the selected mode is classified into the second predictionmode; an order controller configured to rearrange the obtained one ofthe first transformation coefficients and the second transformationcoefficients according to scanning order; and an entropy coderconfigured to encode the rearranged transformation coefficients andinformation indicating the selected mode.
 2. The apparatus according toclaim 1, wherein the order controller rearranges the obtained oneaccording to scanning order corresponding to information about aprediction direction for intra-prediction indicated by the selectedmode.
 3. The apparatus according to claim 2, wherein the ordercontroller rearranges the obtained one according to scanning ordercorresponding to a horizontal direction from among the scanning ordersif the prediction direction for the intra-prediction indicated by theselected mode corresponds to horizontal prediction.
 4. The apparatusaccording to claim 2, wherein the order controller rearranges theobtained one according to scanning order corresponding to a verticaldirection from among the scanning orders if the prediction direction forthe intra-prediction indicated by the selected mode corresponds tovertical prediction.
 5. The apparatus according to claim 1, wherein theselected mode includes information about a block size.
 6. The apparatusaccording to claim 1, wherein the selected mode includes informationabout luminance and color-difference.
 7. The apparatus according toclaim 1, wherein the orthogonal transformation performed by the secondorthogonal transformer is a discrete cosine transformation.
 8. Theapparatus according to claim 1, wherein the second orthogonaltransformer uses the second transformation basis if an inter-predictionis performed.
 9. A moving-picture encoding method, comprising: obtaininga predictive residual signal to be encoded, by using an intra-predictionthat corresponds to a mode selected from a plurality of intra-predictionmodes; classifying the selected mode into a first prediction mode presetin intra-prediction modes or a second prediction mode preset in theintra-prediction modes; obtaining a plurality of first transformationcoefficients by subjecting the predictive residual signal to anorthogonal transformation by use of a first transformation basis if theselected mode is classified into the first prediction mode; obtaining aplurality of second transformation coefficients by subjecting thepredictive residual signal to the orthogonal transformation by use of asecond transformation basis different from the first transformationbasis if the selected mode is classified into the second predictionmode; rearranging the obtained one of the first transformationcoefficients and the second transformation coefficients according toscanning order corresponding to the selected mode from among scanningorders predetermined for the intra-prediction modes; and encoding therearranged transformation coefficients and information indicating theselected mode.